问题描述
我目前正在使用Visual VM监控我正在运行的java应用程序:
I'm currently monitoring my running java application with Visual VM: http://visualvm.java.net/
我用--Xmx128m强调内存使用量。
I'm stressing the memory usage by with -Xmx128m.
运行时我看到了堆大小增加到128m(正如预期的那样)但是在遇到java堆空间错误之前,使用的堆收敛到大约105m。
When running I see the heap size increasing to 128m (as expected) however the used heap converges to approximately 105m before I run into a java heap space error.
为什么这些剩余的20米,未使用?
Why are these remaining 20m, not used?
推荐答案
Xmx / Xms
选项设置整体堆大小。所以一个区域(默认大小)实际上是永久空间 - 也许,我们不知道你的压力测试的细节,实际上没有任何物体从伊甸园转移到终身或永久,所以这些区域仍然是空的,而伊甸园用完了空间。
The Xmx/Xms
option sets the overall heap size. So a region (with a default size) is actually the Permanent Space - and maybe, we don't know details about your stress test, no objects are actually moved from eden to tenured or permanent, so those regions remain empty while Eden runs out of space.
这篇关于Java堆大小未完全使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!