Stack trace for thread causing an OOM
I have a java application which is getting an OutOfMemoryError, for heap space. I've enabled -XX:HeapDumpOnOutOfMemoryError, and have the resultant hprof file.
The dump, however, shows that there is plenty of space left in the heap, permgen, et开发者_C百科c. I believe this may be cause of single request for large amount of memory (e.g., a 1 GB array), which fails and thus doesn't show up in the dump.
Basically I'd like to see the stack of the thread that caused the OOM at the point the OOM is thrown.
Is that possible from the hprof dump?
It is not in the dump because it is in the OutOfMemoryError. If you manage to catch and print the stack trace of that error, it will tell where it happens.
精彩评论