1. Environment
Windows 7 64-bit, JDK 1.7, jvisualvm
2. Problem
Every time I push the HEAP DUMP button in jvisualvm, the JVM always conducts a full GC before dumping, so I can't see all objects before GC.
3. Analysis
3.1 Full Collection VS Young Collection
or in terms of minor collection, major collection, full collection
3.2 why GC before dumping
A good answer from stack overflow:
4. Solution
Reference:
[1] http://stackoverflow.com/questions/1268336/how-can-i-take-a-heap-dump-on-java-5-without-garbage-collecting-first
[2] Manning, the well-grounded Java Developer.
[3] http://stackoverflow.com/questions/5403161/can-jvisualvm-heap-dump-button-release-memory
[4] http://www.cubrid.org/blog/dev-platform/understanding-java-garbage-collection/ (strongly recommended!)