Why the heap is changing in java

不想你离开。 提交于 2019-12-14 03:28:12

问题


we are starting the java process with -Xms equals to -Xmx valuem for example:

-Xms1500m -Xmx1500m -Dos.heap.max=1500m -verbose:gc -XX:MaxPermSize=256m 

and for some reason the heap is changing during runtime...:

[GC 624542K->464935K(1472000K), 0.0647450 secs] Wed Jul 3 15:58:23 2013
[GC 808811K->813332K(1472000K), 0.1407890 secs] Wed Jul 3 15:58:23 2013
[Full GC 813332K->636599K(1472000K), 0.7913590 secs] Wed Jul 3 15:58:24 2013
[GC 1016090K->956043K(1258752K), 0.1209670 secs] Wed Jul 3 15:58:24 2013
[Full GC 956043K->955974K(1258752K), 0.4132560 secs] Wed Jul 3 15:58:25 2013
[Full GC 1126726K->1122269K(1258752K), 0.4376340 secs] Wed Jul 3 15:58:25 2013
[Full GC 1126726K->1115353K(1258752K), 0.8102960 secs] Wed Jul 3 15:58:26 2013

The question is why the heap memory is changing in runtime...?


回答1:


I understand the question to be why the heap size drops from 1500m (1472000K) to something less (1258752K) even though initial size is set to 1500m.

As it turns out, this is well known behavior in long running JVMs, and is related to the PS MarkSweep / Full GC mechanism - See this article for a good writeup.

Cheers,



来源:https://stackoverflow.com/questions/17468362/why-the-heap-is-changing-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!