Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HeapDumpOnOutOfMemoryError not creating hprof

Tags:

java

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?

like image 513
user1559521 Avatar asked Mar 24 '23 23:03

user1559521


2 Answers

See the section marked "Evaluation" at the bottom of this bug report.

http://bugs.sun.com/view_bug.do?bug_id=6784422

The -XX:+HeapDumpOnOutOfMemoryError will not trigger the dump when you cannot create a new native thread.

like image 138
matt freake Avatar answered Apr 13 '23 01:04

matt freake


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.

like image 45
Jules Avatar answered Apr 13 '23 01:04

Jules