In the context of an in-memory database, we are using off-heap memory in conjunction to the G1 collector of hotspot.
However, when off-heap memory usage reaches MaxDirectMemorySize, a full GC is triggered by the JDK code using System.gc()
. This causes a long and painful stop the world GC, that also seem to put all the current live set in the old gen, bypassing the survivor (and thus increasing nepotism issues). This does not happen when setting -XX:+ExplicitGCInvokesConcurrent
: the GC is much faster and respects the survivors.
Since System.gc()
is something used internally by the JDK, why isn't this option on by the default in hotspot? Does this flag induce theoritical or practical issues? Or is just for compatibility reasons? Does anybody has experience of using this option in a production environment, and encountered issues with it?