

Also, this error may be thrown when there is insufficient native memory to support the loading of a Java class. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further. One common indication of a memory leak is the exception. error is thrown when there is insufficient space to allocate an object in the Java heap. Click the Memory tab and select the Garbage Collections tab to inspect the first and the last old collections, as shown in Figure 3-1. If you suspect a rather quick memory leak, then take a profiling recording that runs over, for example, an hour. However, Heap Statistics generates accurate live set information. This may cause a slight latency in the application.

However, another easy approach is to take a flight recording.Įnable Heap Statistics when you start your recording, which triggers an old collection at the start and at the end of the recording. The live set can be inspected in many ways: run with the -verbosegc option, or connect to the JVM using the JMC JMX Console and look at MBean. The live set is the amount of Java heap that is used after an old collection (all objects that are not live have been garbage collected). Watch if the live set of your application is increasing over time. However, memory leaks can be detected early, even before a problem occurs using Java Flight Recordings. Eventually, OutOfmemoryErrors may be seen. A typical symptom is that the application becomes slower after running for a long time due to frequent garbage collections. Detecting a slow memory leak can be hard.
