File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes HeapDumpOnOutOfMemoryError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "HeapDumpOnOutOfMemoryError" Watch "HeapDumpOnOutOfMemoryError" New topic


Todd Baxter

Joined: Sep 26, 2007
Posts: 18
The -XX:+HeapDumpOnOutOfMemoryError creates a heap dump on Out of memory.

The file is called java_pixXXX.hprof

WHERE IS THIS FILE CREATED? Relative to the Java install?
Can I specify where to create this file?

Any help appreciated.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Hi there,



Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Greg Bishop

Joined: Apr 17, 2006
Posts: 5
I've noticed that on JDK 1.5 if clean up (GC) occurs (you catch the out of memory exception and then free up the objects in question),( and then allocate another object forcing GC) the next occurrence does not generate another heap dump (I want one each time).

Is there some way to make it do this again and again?

-Greg Bishop

Greg Bishop, Senior Software Engineer
CESI, 12000 Research Dr. Orlando Florida
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
1. OutOfMemoryError is an ERROR not and Exception. It descends from java.lang.VirtualMachineError.
2. I would certainly not rely on the state of the program after an Error is thrown.

Chandra Varagani

Joined: Aug 19, 2013
Posts: 1
the *hprof file should be created in DOMAIN_HOME by default. and you can customise the path as well like -XX:HeapDumpPath=/folder1/folder2/log etc.
It is sorta covered in the JavaRanch Style Guide.
subject: HeapDumpOnOutOfMemoryError
It's not a secret anymore!