Taking A Heap Dump With jcmd (Java 7 / 8)

  1. Execute jcmd without any parameters to list all JVM processes, starting with a PID. The command jps also does the job.
  2. Execute: jcmd [PID] GC.heap_dump [PATH] to create a heap dump.
  3. Enjoy the memory leak analysis :-)

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!

Comments:

Fuck you alll!
I hate you

Posted by Mariusz on June 19, 2015 at 11:15 AM CEST #

@Mariusz,

it seems like you don't like heap dumps.

Plain Java EE, without threadlocals and custom singletons minimizes the possibility of memory leaks and so the need for taking heap dump.

IMO vanilla Java EE should significantly improve your mood,

--adam

Posted by Adam Bien on June 22, 2015 at 01:48 PM CEST #

Heh....never seen someone so angered by heap dumps :-)
Maybe he wasn't held enough as a child ?!

Posted by 142.245.59.9 on October 26, 2016 at 05:54 PM CEST #

Thank you for sharing this information. It worked! I love you.

Posted by memo on September 08, 2017 at 03:51 PM CEST #

it not works , before i get a heap dump , jvm did a full gc that is not what i want

Posted by randy.lou on September 27, 2017 at 07:46 AM CEST #

Usually when you get a heap dump you want to know what is in memory long term, i.e., leaking, not about garbage.

Posted by bobfoster on April 05, 2018 at 02:07 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments
License