Epsilon GC 只分配不回收,到底有什么用?这篇验证它堆满时的行为、短任务里的速度,以及作为「没有屏障」的基线测量引用存储(其它回收器的行为见前面的篇目)。
JVM 输出(去掉时间戳后的前几行):
[info][gc] Using Epsilon
[info][gc] Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 14248K (5.44%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 29939K (11.42%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 43588K (16.63%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 59972K (22.88%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 76356K (29.13%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 92740K (35.38%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 106M (41.63%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 122M (47.88%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 138M (54.13%) used
[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 154M (60.38%) used
程序捕获到:
JVM 退出码 = 3;GC 日志里 Pause 的行数 = 0回收器 耗时 GC 日志里的 Pause 次数 Epsilon 161 ms 0 Serial 92 ms 3 Parallel 87 ms 3 G1 126 ms 3 (如果堆只有 256 MB,总分配量超过堆时 Epsilon 的结果:) 退出码 3;输出末尾:[info][gc] Heap: 256M reserved, 256M (100.00%) committed, 234M (91.65%) used | [info][gc] Heap: 256M reserved, 256M (100.00%) committed, 250M (97.90%) used | Terminating due to java.lang.OutOfMemoryError: Java heap space
Epsilon 引用存储 0.346 ns/次 Serial 引用存储 0.418 ns/次 G1 引用存储 1.473 ns/次