jdk1.6 memory layout

2019-07-16 01:42发布

i am using jdk1.6. I configureg Xmx = 2G, Xms= 2G, NewSize = MaxNewSize = 660m

I enable verbose gc. I see this which I am not undertsnaidng:

PSYoungGen      total 608256K, used 32440K 
 eden space 540672K, 6% used 
 from space 67584K, 0% used 
 to   space 67584K, 0% used 

According to my configuration YoungGen size is 675840MB. Because younGen = Eden + two survivor spaces,

GC log saying that my YoungGen size = 608256K which is not what i've configured. Also if I add Eden space and two survivor spaces I am getting 540672K + 67584K + 67584K = 675840K

which is also wrong.

But Eden + 1 Survivor space = 540672K + 67584K = 675840K, what i have configured. So does this mean that YoungGen = Eden + 1 Survivor space? I think there are two survivor space, correct?

Please explain me.

thanking you

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-16 02:05

There are two survivor spaces, but only one is used at any given time; objects get moved back and forth from one survivor space to the other every time there's a young-generation garbage-collection. So your configured young-generation space is equal to the eden space plus one of the survivor-spaces; the other is basically just overhead.

查看更多
登录 后发表回答