HeapDumpOnOutOfMemoryError not creating hprof
My program throws the following exception:
java.lang.OutOfMemoryError: unable to create new native thread
But when I added
-XX:+HeapDumpOnOutOfMemoryError to the jvm parameters, but it seems that jvm didn’t dump the heap, cause I never find any .hprof file. Why?
See the section marked “Evaluation” at the bottom of this bug report.
-XX:+HeapDumpOnOutOfMemoryError will not trigger the dump when you cannot create a new native thread.
Failure to create a thread isn’t actually an out of memory condition; it’s usually caused by a lack of native OS resources, not a lack of heap space. A heap dump is probably not what you want in this situation… a stack dump of your current threads is likely to be far more useful.