Using VisualVM and checking Tomcat 8.5 catalina.out log I see that almost every time (7 out of 11 times or so) when full GC happens logs show OutOfMemory (at the exact same minute).
With Tomcat parameters that have something to do with memory management: -Xms3G -Xmx=6G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:MaxHeapFreeRatio=100
At first I thought that it was because of default -XX:MaxHeapFreeRatio value which is 70 since I saw that max. heap size (and used heap of course) would drop significantly during full GC - to ~10-20%. However adding XX:MaxHeapFreeRatio=100 did not fix it.
Although this is memory usage graph with different set of JVM parameters (can not get the one with old JVM parameters ATM) it is similar in a way after full GC memory usage grows rapidly, same max. heap size and that max. heap size does not drop.
Any ideas why this could happen?
Update: I forgot to mention that previously full GC and OutOfMemory would happen when heap size was not even full - ~5GB. Back then not a single time did I see heap reach 6GB.