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

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

Unfortunately, logs are not collected when this error occurs. Re-creating this will take a couple of hours. I was hoping some tools might show an exception stack trace or all thread stacks, etc. From hprof.

I am currently using MAT , could not find a way to get the flow information. Which tool could I use?

(I'm not sure if the hprof file contains information about the stream / location of the call when OOM occurs).

(I know how to dump a thread in normal cases. The problem here is that the event has already occurred, all I have is an hprof dump.)

+7
source share
7 answers

MAT can show streams right now (maybe this was added after the question was asked).

Topics Overview

To get an overview of all threads in the heap heap, use the "Browse threads" button on the toolbar, as shown in the figure below. Alternatively, you can use the query Query Browser> Topic overview and stacks:

toolbar icon screenshot

+3
source

Answering your own question. Credit goes to @RC

  • Open the dump using visualvm. It will take some time.
  • click "heap dump threads"

visual vm with threads at heapdump

+11
source

I don’t think the heap heap contains thread information other than GC root. If you need stream-related information, you also need to take a stream dump.

0
source

The Eclipse MAT allows you to see suspicious flows in a report of suspected leaks. Look for classes in the application namespace with line numbers to find out how much memory they occupy on the heap. This will give you a hint of leaking classes.

0
source

You can kill -3 process identifiers to get a thread dump. This will not kill the java process, so you can do this as many times as you want.

since RC stated that visualVM is a good tool that will give you the number of objects by class type and all kinds of graphs and profiling tools.

0
source

Use visualvm.

try to analyze the graph when the heap memory space exceeds ... u should also check the memory samples and save the snapshot.

Stream stack analysis ... will help you narrow down the problem.

0
source

To enable the option you need + and disable the option you need -

What is misleading regarding the documentation is that it shows the default setting so that it "clears" the settings that you already have. Those with + are turned on by default, and those who have - are disabled by default. This means that if you copy any of the + or - options from the documentation, they should not do anything (except when the default value has changed over time)

-XX: -HeapDumpOnOutOfMemoryError disables the heap dump, which is the default.

-XX: + HeapDumpOnOutOfMemoryError enables a heap dump.

-one
source

All Articles