简体   繁体   中英

OutOfMemoryError heap dump

I have a java.lang.OutOfMemoryError:GC Overhead limit exceeded . There is no HeapDumpOnOutOfMemoryError command line option for my application. I need a heap dump but when I try to capture the dump with jmap or jcmd tools they are not responding:

jmap

D:\program>jmap -dump:live,format=b,file=d:\dump4.hprof 8280
Dumping heap to D:\dump4.hprof ...

jcmd

D:\program>jcmd 8280 GC.heap_dump d:\dump6.hprof
8280:

Processes are not completing but dump files are created. When I open them with VisualVM, they are loading infinitely.

If I capture a heap dump of eg VisualVM, Tools complete successfully and dumps are created and opened.

Could you please explain why jmap and jcmd are not completing? And how can I capture a dump of the application with OutOfMemoryError exception? Application is still working but there are only a few live threads.

One possibility is that the heap size you intend to dump is too large in size. Please specify the size of the heap and RAM.

It is not due to your intended heap size is more than allocated heap size. This error occurs when the JVM spent too much time performing Garbage Collection and was only able to reclaim very little heap space. Your application might have ended up using almost all the RAM and Garbage collector has spent too much time trying to clean it and failed repeatedly.

Your application's performance will be slow comparatively, This is because the CPU is using its entire capacity for Garbage Collection and hence cannot perform any other tasks.

Following questions need to be addressed:

  • What are the objects in the application that occupy large portions of the heap?
  • In which parts of the source code are these objects being allocated?

You can also use automated graphical tools such as JConsole which helps to detect performance problems in the code including java.lang.OutOfMemoryErrors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM