We have been struggling to diagnose the cause of an OutOfMemoryError we experienced on one of our production servers. Our attempts to reproduce the issue in soak tests have so far failed, and we are considering enabling -XX:+HeapDumpOnOutOfMemoryError
on our production servers, so that if it does happen again, at least we'll have some data.
Is it wise to enable this setting on production servers?
Take a look in documentation:
-XX:+HeapDumpOnOutOfMemoryError
flag does not introduce performance or security problems in run time. The flag is checked only afterOutOfMemoryError
has happened.You can specify the actual path to which the file is saved using the corresponding
-XX:HeapDumpPath
flag. (Regardless of where the file is saved, make sure the filesystem and/or the Java process has the necessary permission configuration to be able to write there.)