4

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

  1. get rid of useless data
  2. verify/simulate garbage collection with the various algorithms to see how well they work
  3. identify garbage collection problems
Thilo
  • 257,207
  • 101
  • 511
  • 656

1 Answers1

6

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

moodywoody
  • 2,149
  • 1
  • 17
  • 21
  • 1
    It may remove unreachable objects, but based on my experience, it doesn't remove objects which are only reachable by soft/weak reference (which are, by definition, eligible for gc). Unfortunately, this sometimes makes analyzing a heap dump with MAT difficult since a lot of objects which should be gc'able still show up in the heap dump. I would love to have a tool which can gc the heap dump file, taking into account soft/weak references. – JimN Nov 25 '14 at 19:53