Announcement Announcement Module
No announcement yet.
BUndle Undeployment- Not GC'e - holds reference to - CachedIntrospectionResults Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • BUndle Undeployment- Not GC'e - holds reference to - CachedIntrospectionResults

    I have a application bundle which i deploy- undeploy 100 times with 10 seconds interval.

    Then i take a heap dump and read it using Eclipse MAT.

    I see that none of the classloaders are garbage collected and there are 100 instances of it.

    When i see GC root to the instances it shows that org.springframework.beans.CachedIntrospectionResul ts holds reference to all the classloaders.

    I have attached the GC root obtained in MAT.

    As a solution to this i added the following in my shutdown method

    to unregister the bundle classsloader.
    When i explicity remove the classloader from there , garbage collection happens fine and classloaders are garbage collcted.

    But i am not sure why does
    org.springframework.beans.CachedIntrospectionResul ts have reference to my bundle after undeployment ?

  • #2
    I have figured out that this issue is with spring Core where it caches the class instance and does not clear it on undeployment.

    I have a simple bundle with this xml

    <bean id="bean1" class="com.test.Bean1">
       <property name="bean2" ref="bean2"></property> 
    <bean id="bean2" class="com.test.Bean2"></bean>

    When i deploy undeploy this bundle 100 times i see in teh trace that class refernce is help by CachedIntrospectionResults.

    All 150 instances of classloader is not garbage collected because of this.

    Attached is the snapshot from MAT