Jeff Axelrod
Jeff Axelrod

Reputation: 28198

How can I use Eclipse Memory Analyzer Tool to dump the heap from a running process?

I created a simple console application that I run from Eclipse (right clicking on the file and selecting run as Java application.) I stuck a sleep in there so I can ensure that the process is still running when I start the Aquire Heap Dump Dialog. I start the dialog, hit refresh, and there are no local processes listed.

I checked Eclipse's error log and it only reports that it had problems listing the IBM VM processes (the HPROF one is configured and working fine.)

What am I doing wrong?

Upvotes: 3

Views: 2421

Answers (2)

Jugal Panchal
Jugal Panchal

Reputation: 1548

I faced same issue and after googled I found this solution.

Specify jdk path in "Acquire Head Dump" -> "Configure..." -> Select "HPROF jmap dump provider" -> "-jdkhome" -> speficy jdk path by default it should be "C:\Program Files\Java\jdk1.8.0_102" or your jdk location.

I hope it works for you.

Upvotes: 0

maarten
maarten

Reputation: 465

Why not create the heap dump from your program code?

https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java

Or when that runs into security issues from here: create heap dump from within application, without HotSpotDiagnosticMXBean

I used that to take a heap dump after a fixed number of iterations in my JUnit tests, all that is left to do is open the dumps in Eclipse MAT and find the cause of the memory leak :-(

Upvotes: 3

Related Questions