mibollma
mibollma

Reputation: 15118

Proper strategy in case no heap dump is generated

I got a server running a Java application on OpenJDK and CentOS.

However the application seems to have a memory leak and crashes every few weeks. The problem is that although HeapDumpOnOutOfMemoryError is specified no heap dump is generated. If i create an artificial memory leak which crashes the application immediately a proper heap dump is generated.

Now i'm not asking for a complete solution to this problem but for a good strategy.

Is there a way to pull a heap dump on demand while the application is running after a week for example? Is there a way to figure out whats going wrong in OpenJDK? Do you got any alternative suggestions on how to approach this?

Upvotes: 2

Views: 2630

Answers (1)

Jörn Horstmann
Jörn Horstmann

Reputation: 34034

OpenJDK should contain a tool called jmap which can create a heap dump given a process id. For the exact syntax you would have to look at the jmap man page. If there is a memory leak then this should be visible in the heap dump even before the app crashes. I can also recommend the eclipse memory analyzer to browse the heap dump and get a list of leak suspects.

Upvotes: 2

Related Questions