2013-01-09 30 views

回答

2

使用Runtime.maxMemoryRuntime.totalMemory返回當前堆大小。

+0

我已配置-Xmx 400m但Runtime.maxMemory返回355 ... 爲什麼這種波動?我可以配置準確的Xmx值嗎? – mreaevnia

+0

好問題。我的回答是否定的。另見http://stackoverflow.com/questions/13729652/runtime-maxmemory-and-xmx –

2

totalMemory報告當前堆大小,該堆大小隻根據需要增加至Xmx限制。 maxMemory報告最大堆大小。