Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to view threads from hprof dump / threads in heap dump

I have got a large (5GB) hprof dump, created by application when OutOfMemoryError occurred. (Using XX: HeapDumpOnOutOfMemoryError ).

Unfortunately there are no logs collected when this error happened. Re-creating this will take couple of hours. I was hoping if some tools could show the exception stack trace or all threads stacks etc from hprof.

I am currently using MAT, could not see a way to get thread information. Which tool I could use?

(I am not sure if hprof file has information about thread/location of call when OOM occurred).

( I do know to how to take thread dump in normal cases. The trouble here is the event already happened, all I have is the hprof dump. )

like image 627
Jayan Avatar asked Sep 12 '12 05:09

Jayan


People also ask

How do I view thread dumps?

To find the long running threads, highlight all the thread dumps you want to check, and then click on the binoculars: In the pop up dialogue, click start detection, and you'll get your long running threads just below the dumps themselves: In my example, each thread dump has 157 threads.

How do I view heap dump files?

If you have a heap dump file saved on your local system, you can open the file in Java VisualVM by choosing File > Load from the main menu. Java VisualVM can open heap dumps saved in the . hprof file format. When you open a saved heap dump, the heap dump opens as a tab in the main window.

Is heap dump same as thread dump?

Thread Dump is used to check whether you're stuck in a deadlock condition. Heap Dump is used to detect memory leaks.

What is heap dump Hprof?

A heap dump is a snapshot of all the objects that are in memory in the JVM at a certain moment. They are very useful to troubleshoot memory-leak problems and optimize memory usage in Java applications. Heap dumps are usually stored in binary format hprof files.


1 Answers

Answering own question. Credit goes to @ RC

  1. Open the dump using visualvm. It takes a while.
  2. click on "threads at heap dump"

visual vm with threads at heapdump

like image 72
Jayan Avatar answered Sep 21 '22 13:09

Jayan