How to generate a heap dump and what is the default location of heap dump and what is the format ?

Questions by kirankumar samudrala   answers by kirankumar samudrala

Showing Answers 1 - 9 of 9 Answers

Preetham R Enjamuri

  • Jan 17th, 2012
 

Get the pid of the JVM (either from logs directory) or do a ps-ef |grep
then by using the pid
kill -3
Heap dumps location generally in the logs folder.
or you can change the location by getting into the admin console.

  Was this answer useful?  Yes

Ritam

  • May 5th, 2013
 

To generate a heap dump we need to login to dmgr level bin directory and run the below

Code
  1. ./wsadmin.sh<----after that wsadmin prompt will come

  2.  

  3. wsadmin>set jvm[$AdminControl CompleteObjectNames

  4.  

  5. type=jvm,process=server1,*]<---server1 will be that server for which you are taking dumps

  6.  

  7. wsadmin>$AdminControl.invoke $jvm generateheapdumps

  8.  

  9.  

  10. Default location:temp

  Was this answer useful?  Yes

There are several method to take heap dump, see the following methods

HeapDumpOnCtrlBreak
Set this option when starting JVM.It will create heap dump every time ctrl+break (kill -3) signal is sent to JVM. HeapDumpPath is used to set location of heap dumps.
HeapDumpOnOutOfMemoryError
This JVM option will create heap dump every time when your application throws an OutOfMemoryError
Jmap
Jmap is a tool that comes with JDK installation. To use it we need a PID of our java process.
For instance, jmap -dump:file=C:heapdumpsdump.bin 1212
HotSpotDiagnosticMXBean
This option is available in Java 1.6+ and uses sun.management.ManagementFactory.

Once we get the heap dump, we can analyse a tool like VisualVM (also included in JDK installation)to actually try and find the leak.
Another tool is jhat. Command to analyze heap dump

Reference : http://java-latte.blogspot.in/2013/08/stack-and-heap-in-java.html

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions