Tuning G1GC params for aggressive garbage collection?

大兔子大兔子 提交于 2019-12-06 07:21:15

For G1, promptly returning unused memory to the operating system is an OpenJDK 12 feature:

If you a short on memory, it's likely that you need to keep RSS (total memory allocated from the operating system) under control, not just used memory in the Java heap. With G1 in current OpenJDK, (semi-)manually triggered full GCs appear to be the only way to trigger RSS reduction. (G1 will perform poorly if you change the ergonomics that full GCs happen frequently.)

If your OpenJDK build contains the Shenondoah collector, it may be a better choice if you need to conserve memory, particularly with some tuning, such as using -XX:ShenandoahGCHeuristics=compact.

ZGC should eventually support returning memory as well, but it currently does not; the patch adding an -XX:+ZReleaseUnusedHeap option has not been merged.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!