-
Enhancement
-
Resolution: Unresolved
-
P3
-
8-shenandoah, 11-shenandoah, 13, 14
Current Shenandoah code reports the last region in humongous chain as partially used, when there is free space there. While it is arguably the accurate way to describe the data in the region, that space is still not allocatable, and as far as users are concerned it is "used" by the GC.
Current behavior can be seen when allocating lots of humongous objects:
public class Alloc {
static Object sink;
public static void main(String... args) {
for (int c = 0; c < 1_000_000; c++) {
sink = new byte[1_048_576];
}
}
}
$ java -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -Xmx4g -Xlog:gc Alloc
[3.259s][info][gc] Failed to allocate 1024K
[3.259s][info][gc] Cancelling GC: Allocation Failure
[3.259s][info][gc] Trigger: Handle Allocation Failure
[3.261s][info][gc] GC(30) Pause Degenerated GC (Outside of Cycle) 1950M->9M(3890M) 1.336ms
[3.341s][info][gc] Failed to allocate 1024K
[3.341s][info][gc] Cancelling GC: Allocation Failure
[3.341s][info][gc] Trigger: Handle Allocation Failure
[3.343s][info][gc] GC(31) Pause Degenerated GC (Outside of Cycle) 1950M->9M(3890M) 1.262ms
Note the used heap size at the beginning of collection is "only" 1950M, while in reality the entire heap is full.
The same trouble comes with non-humongous objects when they retire the region without allocation capacity.
Current behavior can be seen when allocating lots of humongous objects:
public class Alloc {
static Object sink;
public static void main(String... args) {
for (int c = 0; c < 1_000_000; c++) {
sink = new byte[1_048_576];
}
}
}
$ java -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -Xmx4g -Xlog:gc Alloc
[3.259s][info][gc] Failed to allocate 1024K
[3.259s][info][gc] Cancelling GC: Allocation Failure
[3.259s][info][gc] Trigger: Handle Allocation Failure
[3.261s][info][gc] GC(30) Pause Degenerated GC (Outside of Cycle) 1950M->9M(3890M) 1.336ms
[3.341s][info][gc] Failed to allocate 1024K
[3.341s][info][gc] Cancelling GC: Allocation Failure
[3.341s][info][gc] Trigger: Handle Allocation Failure
[3.343s][info][gc] GC(31) Pause Degenerated GC (Outside of Cycle) 1950M->9M(3890M) 1.262ms
Note the used heap size at the beginning of collection is "only" 1950M, while in reality the entire heap is full.
The same trouble comes with non-humongous objects when they retire the region without allocation capacity.