Java Reference
In-Depth Information
Similarly in Java 7:
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
Out of heap memory
When the heap itself is actually out of memory, the error message appears like this:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
The common cases where an out of memory condition is triggered by a lack of heap space
are similar to the permgen case. The application may simply need more heap space: the num-
ber of live objects that it is holding onto cannot fit in the heap space configured for it. Or, the
application may have a memory leak: it continues to allocate additional objects without al-
lowing other objects to go out of scope. In the first case, increasing the heap size will solve
the issue; in the second case, increasing the heap size will merely postpone the error.
In either case, heap dump analysis is necessary to find out what is consuming the most
memory; the focus can then be on reducing the number (or size) of those objects. If the ap-
plication has a memory leak, then take successive heap dumps a few minutes apart and com-
pare them. mat has that functionality built into it: if two heap dumps are open, then mat has
an option to calculate the difference in the histograms between the two heaps.
Search WWH ::




Custom Search