I want to capture the objects that are getting collected during the System GC that occurs when I generate a heap dump. Is there a way to disable that System GC?
You can generate "system dump" instead of "heap dump". I haven't found any documentation on that, but I just tried and it seems that "system dump" doesn't trigger "system GC".
The "system dump" can be requested with generateSystemDump
JMX operation. If you prefer to use kill -3
command, then you'll probably need to add an environment variable to your JVM:
JAVA_DUMP_OPTS=ONDUMP(SYSDUMP)
The "system dump" needs to be processed with jextract
tool before loading to Eclipse MAT. System dump is also much larger than heap dump, mainly because it contains not only object tree, but also the actual object data.