Linux (SL4) 上定义的默认 JVM 堆大小在哪里

发布于 2024-08-10 08:23:29 字数 480 浏览 3 评论 0原文

我目前在 SL4 集群上使用 sun 的 java 1.6。

由于某种原因,1.6 JVM 启动时使用了一个难以置信的大堆,并且无法启动:

java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

如果我使用例如 -Xmx1800M 启动它,那么它可以正常工作。所以,我想知道默认堆大小在哪里设置,更重要的是如何更改它?

该机器有8GB物理内存,我相信sun的服务器JVM应该以默认的一半内存启动,最多512M,但事实显然不是这样,因为它试图分配超过1800M。

编辑:我意识到可以使用 _JAVA_OPTIONS,但这感觉有点笨拙;我期待在某个地方有一个属性文件,但到目前为止我一直找不到它。

I'm currently using sun's java 1.6 on a SL4 cluster.

For some reason, the 1.6 JVM is starting up with an impossibly large heap, and cannot start:

java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

If I start it with e.g. -Xmx1800M, then it works OK. So, I'm wondering where the default heap size is set, and more importantly how to change it?

The machine has 8GB of physical memory, and I believe that sun's server JVM is supposed to start with a default of half the memory up to 512M, but this is clearly not the case, as it's trying to allocate over 1800M.

EDIT: I realise that it's possible to use _JAVA_OPTIONS, but this feels a bit clunky; I was expecting a properties file somewhere, but so far I've been unable to find it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以往的大感动 2024-08-17 08:23:29

没有为此的属性文件。根据垃圾收集器人体工程学

初始堆大小:

大于机器的 1/64
机器上的物理内存或某些
合理的最低限度。在 J2SE 5.0 之前,
默认初始堆大小是
合理的最小值,其变化取决于
平台。你可以覆盖这个
默认使用 -Xms 命令行
选项。

最大堆大小:

小于物理值的 1/4
内存或1GB。在 J2SE 5.0 之前,
默认最大堆大小为 64MB。
您可以使用以下命令覆盖此默认值
-Xmx 命令行选项。

<小时>
注意:为堆大小给出的边界和分数是正确的
对于 J2SE 5.0。他们很可能是
后续版本中的不同之处在于
计算机变得更加强大。


假设您有 8GB RAM,假设您使用的是 Java 6,默认最大堆大小应为 1GB。

There is no properties file for this. According to Garbage Collector Ergonomics:

initial heap size:

Larger of 1/64th of the machine's
physical memory on the machine or some
reasonable minimum. Before J2SE 5.0,
the default initial heap size was a
reasonable minimum, which varies by
platform. You can override this
default using the -Xms command-line
option.

maximum heap size:

Smaller of 1/4th of the physical
memory or 1GB. Before J2SE 5.0, the
default maximum heap size was 64MB.
You can override this default using
the -Xmx command-line option.


Note: The boundaries and fractions given for the heap size are correct
for J2SE 5.0. They are likely to be
different in subsequent releases as
computers get more powerful.


Given you have 8GB of RAM, default maximum heap size should be 1GB assuming you're using Java 6.

岛歌少女 2024-08-17 08:23:29

没有标准属性文件。 (Sun) JVM 中硬编码了默认值。

There's no standard properties file. The (Sun) JVM has the default values hardcoded in it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文