Applications may sometimes terminate with java.lang.OutOfMemoryError. The error is thrown when there is insufficient space to allocate an object.
Why do I get this exception?
First, you must inspect the FULL error message: what comes after the java.lang.OutOfMemory error?
* example 1: Java heap space. Two possibilities here. Perhaps the specified heap size is insufficient for the application...in which case bump up the heap size using the -Xmx option. The alternative possibility is a problem in garbage collection e.g. objects that are no longer needed cannot be garbage collected because the application is unintentionally holding references to them. A common source of this error can be excessive use of finalizers such that the thread to invoke the finalizers cannot keep up with the rate of addition of finalizers to the queue. jconsole can monitor the number of objects pending finalization.
* example 2: Java PermGen space. "PermGen space" indicates the permanent generation is full. This is the area of the heap where the JVM stores its metadata. If an application loads a large number of classes the permanent generation may need to be increased (i.e. -XX:MaxPermSize=n, where n is the size).
* example 3: Requested array size exceeds VM limit. e.g. if max heap size is 256MB (2^8), an you try to allocate an array of 512MB (2^9 i.e. double the size) then you get the "array size exceeds VM limit" problem.
To diagnose OutOfMemoryErrors best tools to use are Heap Analysis Tool (HAT), jconsole management tool and the jmap tool with -histo option.
Ubu World Cafe - Linux Variant CentOs
-
The UbuWarrior has in its awareness a knowledge of other Linux variants.
Today, we talk about the mysterious CentOS. CentOS is derived from RHEL
(Red Ha...
9 months ago
No comments:
Post a Comment