|
Problem(Abstract) |
Under certain circumstances, an enterprise application
(EAR) is stopped, but objects are not cleared from the heap. These objects
could later contribute to OutOfMemory errors. |
|
|
|
Cause |
Objects typically remain on the heap until all references
to them are nullified and the JVM executes a Garbage Collection cycle.
However, objects having a finalizer may not be removed from the heap
during this Garbage Collection cycle. These objects remain in the heap
until all references to them are nullified, the finializer thread runs
(the objects are finalized,) and the JVM executes a subsequent Garbage
Collection cycle. |
|
|
Resolving the
problem |
When the JVM has enough activity to execute frequent
Garbage Collection cycles, objects having a finalizer will not collect on
the heap over time. In other circumstances, it may be necessary to
manually execute Finalization and Garbage Collection to prevent potential
OutOfMemory errors.
In the event that the JVM throws an OutOfMemoryError when successively
restarting an enterprise application (EAR), the following procedure should
resolve this issue.
- Stop the EAR
- Execute the following code from a servlet or JSP in a different EAR in
the same JVM:
System.gc();
System.runFinalization();
- Start the EAR.
|
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|