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!


NEW online workshop: WebStandards Igniter (online)

Airport MUC workshops: Java EE 8, Java 9: Bootstrap, Effective, Architectures, Single Page Apps, Progressive Web Apps, HTML 5, ES 6, CSS 3 and Microservices

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

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 #

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