简体   繁体   English

如何确定初始堆的大小和最大堆

[英]how to decide size of initial heap and maximum heap

I want to change initial heap (-xms) and max heap (-xmx) size in eclipse indigo but I don't know the correct size that must allocated for heap. 我想在Eclipse Indigo中更改初始堆(-xms)和最大堆(-xmx)大小,但我不知道必须为堆分配的正确大小。 What are the considerations in determining the size that fit with the application that used? 在确定适合所使用应用程序的大小时需要考虑哪些因素?

There are several things to consider. 有几件事情要考虑。

First of all - you say that you want to "change" initial sizes of heap and max heap. 首先-您说要“更改”堆的初始大小和最大堆。 So, the question is simple: why do you need it? 因此,问题很简单:您为什么需要它? For example, some time ago I had to change my IntelliJ IDEA's heap settings to higher values, because it couldn't handle my project. 例如,前一段时间我不得不将IntelliJ IDEA的堆设置更改为更高的值,因为它无法处理我的项目。 Or do you have some specific reason to change heap size? 还是您有某些特定原因来更改堆大小?

Eclipse's heap settings can be located in eclipse.ini file. Eclipse的堆设置可以位于eclipse.ini文件中。 At least in my Eclipse Juno, eclipse.ini contains: 至少在我的Eclipse Juno中,eclipse.ini包含:

-Xms40m
-Xmx512m

So, initial size of heap is 40 MB, but it can resize up to 512 MB. 因此,堆的初始大小为40 MB,但最大可调整为512 MB。 Check your eclipse.ini - are numbers the same? 检查您的eclipse.ini-数字是否相同?

And, as I asked previously, could you please tell me, why do you want to change heap settings? 而且,正如我之前所问的,您能否告诉我,为什么要更改堆设置?

EDIT 编辑

Nice tutorial at Eclipse's Wiki about how to change heap size in Eclipse . Eclipse Wiki上的不错的教程,关于如何在Eclipse中更改堆大小

initial heap size Larger of 1/64th of the machine's physical memory on the machine or some reasonable minimum. 初始堆大小大于计算机上物理内存的1/64或合理的最小值。 Before J2SE 5.0, the default initial heap size was a reasonable minimum, which varies by platform. 在J2SE 5.0之前,默认的初始堆大小是一个合理的最小值,随平台的不同而不同。 You can override this default using the -Xms command-line option. 您可以使用-Xms命令行选项覆盖此缺省值。

maximum heap size Smaller of 1/4th of the physical memory or 1GB. 最大堆大小小于物理内存的1/4或1GB。 Before J2SE 5.0, the default maximum heap size was 64MB. 在J2SE 5.0之前,默认的最大堆大小为64MB。 You can override this default using the -Xmx command-line option. 您可以使用-Xmx命令行选项覆盖此默认值。

you can increass by 你可以增加

export _JAVA_OPTIONS="-Xmx1g" java -jar jconsole.jar & Picked up _JAVA_OPTIONS: -Xmx1g 出口_JAVA_OPTIONS =“-Xmx1g” java -jar jconsole.jar并提取_JAVA_OPTIONS:-Xmx1g

or 要么

Setup JAVA_OPTS as a system variable with the following content: 将JAVA_OPTS设置为具有以下内容的系统变量:

JAVA_OPTS="-Xms256m -Xmx512m" JAVA_OPTS =“-Xms256m -Xmx512m”

After that in a command prompt run the following commands: 之后,在命令提示符下运行以下命令:

SET JAVA_OPTS="-Xms256m -Xmx512m" SET JAVA_OPTS =“-Xms256m -Xmx512m”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM