[ACCEPTED]-Making a "memory dump" of java application?-javafx-2

Accepted answer
Score: 17

Use jmap -heap:format=b <process-id> to create a binary dump of the heap 3 which can then be loaded into several tools 2 - my favorite being the "Eclipse Memory 1 Analyzer"

Score: 6

There are lots of ways to get a heap dump, starting 8 with simple tools like jmap to more fancy 7 stuff like JVisualVM or even commerical 6 tools as JProfiler. Correctly interpreting 5 those dumps can be tricky though, so you 4 might want to post exactly what you are 3 looking for. Are going hunting for a memory 2 leak, or are you interested in getting a 1 general feel for your application?

Score: 5

You can use jvisualvm. It has plugin to see live 1 memory and get a dump out of it.

Score: 3

I just re-discovered this article when researching ways 7 to grab "JVM state right at this moment" - after 6 a heap I pulled with jmap was about half the 5 size of what the MBeans reported. I'll add 4 it for completeness:

su $JVM_OWNER -c "gcore -o /tmp/jvm.core $YOUR_JVM_PID"
su $JVM_OWNER -c "jmap -dump:format=b,file=jvm.hprof /usr/bin/java /tmp/jvm.core"

Requires gdb installed 3 (for gcore) and a JDK installation (for jmap). Also 2 note you'd might need to adjust /usr/bin/java to the 1 path of the JVM used for the process.

More Related questions