增加Java中的堆大小 [英] Increase heap size in Java

查看:154
本文介绍了增加Java中的堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用8 GB RAM的Windows 2003服务器(64位)。如何增加堆内存最大值?我使用 -Xmx1500m 标志将堆大小增加到1500 Mb。我可以将堆内存增加到物理内存的75%(6 GB堆)吗?

I am working on a Windows 2003 server (64-bit) with 8 GB RAM. How can I increase the heap memory maximum? I am using the -Xmx1500m flag to increase the heap size to 1500 Mb. Can I increase the heap memory to 75% of physical memory (6 GB Heap)?

推荐答案

你可以增加到4GB 32位系统。如果您使用的是64位系统,则可以更高。如果你选错了,不用担心,如果你在32位系统上要求5g,java就会抱怨无效值并退出。

You can increase to 4GB on a 32 bit system. If you're on a 64 bit system you can go higher. No need to worry if you've chosen incorrectly, if you ask for 5g on a 32 bit system java will complain about an invalid value and quit.

正如其他人发布的那样,使用cmd-line标志 - 例如

As others have posted, use the cmd-line flags - e.g.

java -Xmx6g myprogram

您可以输入java -X来获得完整列表(或者几乎完整列表)。

You can get a full list (or a nearly full list, anyway) by typing java -X.

这篇关于增加Java中的堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆