[jboss-jira] [JBoss JIRA] (AS7-3734) HibernateAnnotationScanner keeps references to application's ClassLoader

Scott Marlow (JIRA) jira-events at lists.jboss.org
Mon Feb 13 09:43:01 EST 2012


    [ https://issues.jboss.org/browse/AS7-3734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666065#comment-12666065 ] 

Scott Marlow commented on AS7-3734:
-----------------------------------

Hmm, the CLASSES_IN_JAR_CACHE storage is cleaned up at application undeploy time and that seems to work well.  Perhaps we should forget about using WeakHashMap for PACKAGES_IN_JAR_CACHE and instead clean up each PersistenceUnitMetadata (key class) when the application is undeployed.
                
> HibernateAnnotationScanner keeps references to application's ClassLoader
> ------------------------------------------------------------------------
>
>                 Key: AS7-3734
>                 URL: https://issues.jboss.org/browse/AS7-3734
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: JPA / Hibernate
>    Affects Versions: 7.1.0.CR1b
>         Environment: Seam 2.2.2 application using JPA/Hibernate 3
>            Reporter: Philippe Guinot
>            Assignee: Scott Marlow
>              Labels: PersistenceUnitMetadata, class, classloader, leak
>
> Well, this is a minor issue as the references are kept in WeakHashMaps. Indeed, the HibernateAnnotationScanner contains static weak maps of the Package/Classes of the current application. They are indexed by PersistenceUnitMetadata.
> When the application gets undeployed the PersistenceUnitMetadata is no longer referenced, and should be garbage collected. However the value of the WeahHashMap won't be removed until the next expunging is done. As the application has been undeployed, it does not really make sense to keep strong references to the classes or packages. So, using Set<WeakReference<Package>> and Set<WeakReference<Class<?>>> would improve garbage collecting of the application's class loader and make more PermGen easily available.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list