8372993: Serial: max_eden_size is too small after JDK-8368740

Reviewed-by: ayang, aboldtch, stefank
This commit is contained in:
Joel Sikström 2025-12-03 14:34:05 +00:00
parent 135661b438
commit c0636734bd
2 changed files with 18 additions and 1 deletions

View File

@ -236,7 +236,10 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
// These values are exported as performance counters.
uintx size = _virtual_space.reserved_size();
_max_survivor_size = compute_survivor_size(size, SpaceAlignment);
_max_eden_size = size - (2*_max_survivor_size);
// Eden might grow to be almost as large as the entire young generation.
// We approximate this as the entire virtual space.
_max_eden_size = size;
// allocate the performance counters

View File

@ -286,6 +286,20 @@ public class TestNewSizeFlags {
if (YOUNG_GC_TYPE == GCTypes.YoungGCType.G1) {
return new MemoryUsage(edenUsageInit + survivorUsageInit, 0,
edenUsageCommited + survivorUsageCommited, Long.MAX_VALUE);
} else if (YOUNG_GC_TYPE == GCTypes.YoungGCType.DefNew) {
// Eden might grow to be almost the entire young generation,
// so it is approximated as the size for the entire young
// generation.
long youngGenUsageMax = edenUsage.getMax();
long combinedSurvivorUsageMax = 2 * survivorUsage.getMax();
if (combinedSurvivorUsageMax > youngGenUsageMax) {
throw new RuntimeException("Unexpectedly large survivorUsage combined maximum value: " + combinedSurvivorUsageMax);
}
return new MemoryUsage(edenUsageInit + survivorUsageInit * 2, 0,
edenUsageCommited + survivorUsageCommited * 2,
youngGenUsageMax);
} else {
return new MemoryUsage(edenUsageInit + survivorUsageInit * 2, 0,
edenUsageCommited + survivorUsageCommited * 2,