OutOfMemory happens when the permanent generation is filled by
softly referenced objects even if the total heap is not used up.
-------------------------------------------------------------------------------
To reproduce this bug, please use attached zip file and jar file.
src.zip includes following source files.
MainEntry.java
The entry point for the sample program.
It repeatedly creates a class loader, loads a target class,
gets bean info using Introspector and remove class and class loader
objects.
VariableJarClassLoader
A Sample Class Loader which loads a jar file and retrieve a class.
Target.java
Target class to be loaded.
Target.jar includes compiled Target class.
USAGE:
1. Compile MainEntry.java and VariableJarClassLoader.java.
2. Run MainEntry limiting the MaxPermSize as following. (Tested on Windows.)
java -Xms64M -Xmx128M -XX:MaxPermSize=2M -verbose:gc test_softref.MainEntry <absolute path of target.jar> test_softref.Target
RESULTS:
- JDK 1.3.1_0x and 1.4.1_0x
After about 400 times of GC, The Introspector cache is filled by bean info
objects and OutOfMemory happens. It happens because the Introspector cache
is implemented as the HashTable in those versions of JDK. (BugID: 4730581)
- JDK 1.4.0_0x
The Introspector cache is implemented as the SoftReference.
After about 100 times of normal GC, during the first full GC, VM tries
to unload softly referenced bean info objects in the Introspector cache.
However, the permanent generation is filled up by those objects and the
OutOfMemory happens. (This bug)
------------------------------------------------------------------------------
This bug is found in a licensee's J2EE application server which
uses many class loaders. It should be fixed soon because
it causes serious server crash.