Results 1 to 2 of 2

Thread: BUndle Undeployment- Not GC'e - holds reference to - CachedIntrospectionResults

  1. #1
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default 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

    Code:
    	CachedIntrospectionResults.clearClassLoader(getClass().getClassLoader());
    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 ?
    Attached Images Attached Images

  2. #2
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    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


    Code:
    <bean id="bean1" class="com.test.Bean1">
       <property name="bean2" ref="bean2"></property> 
    </bean>
    
    <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
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •