Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

java - Missing memory: size of young generation includes only one survivor space

On the Java heap, I expected that the size of the young generation would be the sum of the sizes of the eden space and both of the survivor spaces (from space and to space):

[young gen size] = [eden space size] + [from space size] + [to space size]

However, GC logs (using XX:+PrintHeapAtGC) state that the size of the young generation is the sum of the sizes of the eden space and only one of the survivor spaces:

[young gen size] = [eden space size] + [from space size]

Why does the size of the young generation only include the size of one survivor space?

Maybe because only one of the survivor spaces is available at any time? But both survivor spaces exist so both survivor spaces should contribute to the size of the new generation?

GC log:

{Heap before GC invocations=48 (full 17):
par new generation   total 943744K, used 891496K [0x000000073ae00000, 0x000000077ae00000, 0x000000077ae00000)
  eden space 838912K, 100% used [0x000000073ae00000, 0x000000076e140000, 0x000000076e140000)
  from space 104832K,  50% used [0x000000076e140000, 0x000000077149a040, 0x00000007747a0000)
  to   space 104832K,   0% used [0x00000007747a0000, 0x00000007747a0000, 0x000000077ae00000)

From which:

[young gen size] = [eden space size] + [from space size]
     943744K     =      838912K      +      104832K
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

At any time one of the survivor spaces is always empty, so it cannot be considered available.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...