Reputation: 1211
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
Upvotes: 0
Views: 530
Reputation: 98580
At any time one of the survivor spaces is always empty, so it cannot be considered available.
Upvotes: 2