Reputation: 171
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?
Upvotes: 4
Views: 2763
Reputation: 15199
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.
Upvotes: 2
Reputation: 5090
See the section marked "Evaluation" at the bottom of this bug report.
https://bugs.java.com/bugdatabase/view_bug?bug_id=6784422
The -XX:+HeapDumpOnOutOfMemoryError
will not trigger the dump when you cannot create a new native thread.
Upvotes: 5