views:

816

answers:

3

We are sometimes getting an OutOfMemoryError in production and I would like to be able to analyse what caused the problem, or at least what was going on when it occurred. It seems that I should be able to get an HProf profile by using the -XX:+HeapDumpOnOutOfMemoryError option, but I have read that this is JVM specific.

Has anyone successfully used this option with Oracle Application Server v10.1.2.0.2? If so, do you have any tips on how to analyse the resulting file?

A: 

This option is specific to SUN/SAP/HP JVM's, and I doubt it would work if you use the JRockit VM. JRockit might also not support the hprof format at all, because it's not required by the Java spec.

You may want to check Yourkit which is the only tool I'm aware of that comes close to the Eclipse Memory Analyzer for memory usage analysis. It seems to support JRockit.

kohlerm
A: 

Yes, It depends on your JVM version. Some JVMs do not seem to support -XX:+HeapDumpOnOutOfMemoryError parameter.

+2  A: 

Oracle OC4J is certified for Sun JVM 1.3.1 and 1.4.2 (see this PDF).

The -XX:+HeapDumpOnOutOfMemoryError option was introduced in Java 6 and backported to Java 5.0 update 7 and Java 1.4.2 update 2. So in order to use this option you should run OC4J on one of these JVM's.

To analyse a hprof memory dump you can use quite a number of tools such as Eclipse Memory Analyzer (included with Eclipse 3.5 Galileo), VisualVM or NetBeans.

R. Kettelerij