1

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?

Ion Ionascu
  • 552
  • 1
  • 4
  • 15
  • Analyzing a heapdump with jvisualvm proves that the classloader doesn't get garbage collected even though there are no references to it and the classes loaded by it have no live instances. – Ion Ionascu Mar 26 '13 at 22:49
  • I have also posted this question on Oracle Forum for JRockit: https://forums.oracle.com/forums/message.jspa?messageID=10934214 – Ion Ionascu Mar 28 '13 at 11:14

0 Answers0