Does Yourkit have a utility to obtain heapdump on JRE ?

Questions about YourKit Java Profiler
Post Reply
anjanbacchu
Posts: 2
Joined: Tue Mar 29, 2016 7:27 am

Does Yourkit have a utility to obtain heapdump on JRE ?

Post by anjanbacchu »

Our product runs on our customer's servers with only a JRE.

I have Yourkit 2015 for windows to analyze the heap dumps from the customers. I know that I can get a heap dump on OutOfMemoryError thorugh a flag.

Is there a way to get a heap dump from the JRE JVM process when the JVM is healthy ? Do you have a utility which I can use to get the heap dump from the customer deployment ?

I was planning on getting a few healthy heap dumps and compare them with the heap dump obtained on OutOfMemoryError.

Thank you,
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Does Yourkit have a utility to obtain heapdump on JRE ?

Post by Anton Katilin »

Of course you can, in many ways.

The simplest thing you can do is to use the Java's jmap utility to produce a HPROF dump:
https://www.yourkit.com/docs/java/help/ ... pshots.jsp

For comprehensive profiling, if you need more than just a heap dump, run the profiled application with the profiler agent or attach the agent to a running JVM instance, then capture a memory snapshot or use other capabilities of the profiler.
anjanbacchu
Posts: 2
Joined: Tue Mar 29, 2016 7:27 am

Re: Does Yourkit have a utility to obtain heapdump on JRE ?

Post by anjanbacchu »

Hi Anton,

thanks for the quick response.

I knew about jmap but the problem is that jmap is not part of the JRE. It is only available on a JDK. I tried copying the jmap onto customer server, but jmap was giving me some errors. So, wondering if yourkit has a utility that can dump the heap ?

thank you
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Does Yourkit have a utility to obtain heapdump on JRE ?

Post by Anton Katilin »

What jmap error do you get? Could you please provide the full message.

Please note that jmap also uses Java attach mechanism. If, for instance, the problem is that jmap cannot attach to that JRE, then you won't be able to attach to it the profiler agent too. Please try the attach wizard to check if attach is available:
https://www.yourkit.com/docs/java/help/ ... wizard.jsp

If attach is unavailable, you'll need to start the application with the profiler agent:
https://www.yourkit.com/docs/java/help/ ... remote.jsp

After the profiler agent is loaded either way (via attaching the agent to a running JVM instance or by starting JVM with the agent), use the command line tool to capture a snapshot:
https://www.yourkit.com/docs/java/help/ ... e_tool.jsp
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Does Yourkit have a utility to obtain heapdump on JRE ?

Post by Anton Katilin »

Update:

Some older JVM versions also offered an ability to capture a heap dump on demand: if you specified the JVM option -XX:+HeapDumpOnCtrlBreak you would be able to dump the heap by pressing Ctrl+Break in console or sending a signal via "kill -QUIT <JVM's pid>"

Note: the newest JVMs do not support this option any longer, relying on jmap instead:
http://stackoverflow.com/questions/9577 ... nctrlbreak
Post Reply