I create an instance of a custom classloader and I want to check if it gets garbage collected once there are no more references to it. This classloader loads custom classes that instantiate objects. There are no outside references to these objects or the classes inside the classloader. Also, when I want to test the garbage collection, there are no more references to the classloader.
In order to test whether the classloader gets garbage collected, I use a weak reference to it.
Now, on HotSpot 1.7, everything works fine, whereas on jrockit_160_24_D1.1.2-4, it doesn't (when I call get()
on the weak reference, I get back the object).
Does anybody know why this happens?