After a garbage collection, if the Java application spends more than approximately 98% of its time performing garbage collection and if it is recovering less than 2% of the heap and has been doing so for the last five (compile-time constant) consecutive garbage collections, then a error is thrown. SeeĪnd Phantom References in Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide for information about detectingĭetail Message: GC Overhead limit exceededĬause: The detail message GC overhead limit exceeded indicates that the garbage collector (GC) is running most of the time, and the Java application is making very slow progress.
More about how to monitor objects for which finalization is pending. See Monitoring the Objects Pending Finalization to learn One scenario that can cause this situation is when an application creates high-priority threads that cause the finalization queue to increase at a rate that is faster than the rate at which the finalizer thread is servicing that queue.Īction: Try increasing the Java heap size. If the thread cannot keep up with the finalization queue, then the Java heap could fill up, and this kind of error would be thrown.
In the Oracle implementations of the Java Runtime, finalizers are executed by a daemon thread that services the finalization queue. Instead, after garbage collection, the objects are queued for finalization, which occurs at a later time. If a class has a finalize method, then objects of that type do not have their space reclaimed at garbage collection time. One other potential source of this error arises with applications that make excessive use of finalizers. Note:The APIs that are called by an application could also unintentionally be holding object references. The initial and maximum size of the Java heap space can be configured using the –Xms and –Xmx options. The problem can be as simple as a configuration issue, where the specified heap size (or the default size, if it is not specified) is insufficient for the application. This error does not necessarily imply a memory leak. Was it thrown because the Java heap is full or because the native heap is full? To help you discover the cause, a detail message is appended to the text of the exception, as shown in the following examples:Ĭause: The detail message Java heap space indicates that an object could not be allocated in the Java heap. The error can also be thrown by native library code when a native allocation cannot be satisfied (for example, if swap space is low).Ī stack trace is printed when a error is thrown.Īn early step to diagnose a error is to determine its cause. In rare instances, the error is thrown when an excessive amount of time is being spent performing garbage collection, and little memory is being freed. This error may also be thrown when there is insufficient native memory to support the loading of a Java class. This error indicates that 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 error.