1 Reply Latest reply on Apr 16, 2018 4:15 AM by adinn

    LoadCache holds strong references to Classloaders - indirectly


      Hi Andrew,


      loaderMaps in LoadCache is a WeakHashMap. But since the secondary map in the loaderMaps, holds a strong reference to the class loaded by the Classloader (key of the loaderMap), the ClassLoader is not collectable.


      A test case for this is at: LoadCacheReferenceTest.java · GitHub  ... for convenience I did not import junit, but it can be easily converted in junit tests.


      I believe if the secondary map held a WeakReference to the Class, all the three tests in the test case will pass.