Search code examples
javaheap-dumphprofeclipse-mat

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. )


Solution

  • MAT can show the threads directly now (perhaps this was added since the question was asked).

    Threads Overview

    To get an overview of all the threads in the heap dump use the "Thread Overview" button in the toolbar, as shown on the image below. Alternatively one could use the Query Browser > Thread Overview and Stacks query:

    screenshot of toolbar icon