问题
I have a huge Java heap dump file. It also contains (I believe) unreachable objects, that would be garbage collected by the JVM (or so one hopes).
Is there a tool that allows me to run the garbage collector against this file, so that I can
- get rid of useless data
- verify/simulate garbage collection with the various algorithms to see how well they work
- identify garbage collection problems
回答1:
No idea about 2+3 (and I don't think it would be possible) but at least requirement 1 is the default in the Eclipse Memory Analyzer
"By default unreachable objects are removed from the heap dump while parsing and will not appear in class histogram, dominator tree, etc"
http://wiki.eclipse.org/MemoryAnalyzer/FAQ
来源:https://stackoverflow.com/questions/9662337/can-i-run-java-garbage-collection-against-a-heap-dump-file