How to use jmap heap

I have seen in tutorials, that with command jmap -heap<pid>, I can receive info about heap state.

Now this command is unavailable.

There are only jmap -dump:live,format:b,file=heap.bin but it save data to unreadable bin format.

How can I receive heap state info using jmap to console?

*On Windows

Upd. I found the answer: On new versions Jdk we can use command:

jhsdb jmap --heap --pid

Upvotes: 1

Views: 5365

Answers (3)

I found the answer. In new JDK versions it works:

jhsdb jmap --heap --pid <pid number>

Upvotes: 2

leonardkraemer
leonardkraemer

Reputation: 6793

You can analyze the heapdump generated by jmap -dump:live,format:b,file=heap.bin with https://www.eclipse.org/mat/. MAT is able to read the binary format.

Upvotes: 0

Steephen
Steephen

Reputation: 15824

If you are running on a Unix/Linux platform execute following command to generate the heap dump.

kill -3 <PID of the Java Process>

Generated heap dump file will be either in home directory of the user executed the command, or in absolute path of the jar file.

Upvotes: 0

Related Questions