Suppose you get Java heap dump to analyze memory leak (after -XX:+HeapDumpOnOutOfMemoryError or from non-controlled party).
How can I reduce object count in dump by calling some GC process, which in any case be cleaned by GC after dumping process?
On
Possible solutions;
You can't dump the PermGen and your dump has only reachable objects or you wouldn't have got an OOME in the first place.
Seems that Eclipse Memory Analyzer Can I run Java garbage collection against a heap dump file? do that:
@Guntram Blohm. As you say the reason for OOME is out of memory or storage manager was unable to reclaim enough memory. In case if you require long array for fragmented memory it is possible that GC isn't performed at all!