1 Reply Latest reply on Jun 6, 2019 12:16 PM by JimTerry

    Java Heap error


      One of my application using Java JDK.



      After running my application I am getting Java heap memory error in some time.



      I kept my java heap size as 4096m.



      How can I handle this java heap automatically with runtime parameter?

        • 1. Re: Java Heap error

          When application experience java.lang.OutOfMemoryError, it’s ideal to capture heap dump right at that point to diagnose the problem because you want to know what objects were sitting in memory and what percentage of memory they were occupying when java.lang.OutOfMemoryError occurred. However, due to the heat of the moment, most times, IT/Operations team forgets to capture heap dump. Not only that, they also restart the application. It’s extremely hard to diagnose any memory problems without capturing heap dumps at right time.

          That’s where this option comes very handy. When you pass ‘-XX:+HeapDumpOnOutOfMemoryError’ system property during application startup, JVM will capture heap dumps right at the point when JVM experiences OutOfMemoryError.

          Sample Usage:

          -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/tmp/heapdump.bin

          Note: Captured heap dump will be printed at the location specified by ‘-XX:HeapDumpPath’ system property.