Unable to find java heap file

Hello,

I am getting an error:
java.lang.OutOfMemoryError: Java heap space

To ensure I don’t have a memory leak I am attempting to evaluate the heap as suggested here.

I put the following in my setenv.sh file:
CATALINA_OPTS="$CATALINA_OPTS -XX:-HeapDumpOnOutOfMemoryError"

But after generating the out of memory error, I am unable to find the heap file. I expected to see it in the logs directory, along side app.log file but no luck. I’m not sure it’s even being generated because I tried searching my mac for a file containing “hprof” and no luck. I see the following in my catalina.out file:
INFO: Command line argument: -XX:-HeapDumpOnOutOfMemoryError
so I’m fairly confident the argument is properly implemented.

Am I looking in the wrong place? Did I implement the argument improperly?

Thanks

Hi,

By default the heap dump is created in a file called java_pid.hprof in the working directory of the VM. Nevertheless I’d recommend that you use -XX:HeapDumpPath= argument in order to specify custom heap dump location. See also Java documentation.

Thank you. That is helpful.

It turns out I had a minus sign when I should have a plus sign. The following helped produce the heap file.
CATALINA_OPTS="$CATALINA_OPTS -XX:+HeapDumpOnOutOfMemoryError"