0 Replies Latest reply: Mar 28, 2013 6:12 AM by 999727 RSS

    JRockit classloader not being garbage collected

    999727
      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.

      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.

      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?

      I have also posted this question on stackoverflow: http://stackoverflow.com/questions/15635264/jrockit-classloader-not-being-garbage-collected


      Thank you,
      Ion Ionascu

      http://www.ionionascu.eu/