[jboss-jira] [JBoss JIRA] (AS7-3733) AWT AppContext / EventQueue ClassLoader Memory Leaks
Remy Maucherat (JIRA)
jira-events at lists.jboss.org
Tue Feb 14 10:56:01 EST 2012
[ https://issues.jboss.org/browse/AS7-3733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666416#comment-12666416 ]
Remy Maucherat commented on AS7-3733:
-------------------------------------
The context classloader is not yet bound during the init event, which is the one used by the Tomcat listener. I did sync with the Tomcat listener to have it at hand for people willing to hack, but it won't do the exact same thing since deployment is not the same [you can add your own "memoryleak" subsystem to cleanly replicate what Tomcat is doing if you really need it].
It is up to the application server to add these leaks hacking though, and it doesn't seem to be something that will happen.
> AWT AppContext / EventQueue ClassLoader Memory Leaks
> ----------------------------------------------------
>
> Key: AS7-3733
> URL: https://issues.jboss.org/browse/AS7-3733
> Project: Application Server 7
> Issue Type: Bug
> Components: Web
> Affects Versions: 7.1.0.CR1b
> Environment: AS 7 running on JDK 1.6.0_30, Windows 7
> Reporter: Philippe Guinot
> Assignee: Remy Maucherat
> Labels: appcontext, as7, awt, classloader, eventqueue, jboss, leak
>
> The use of libraries using awt components creates ClassLoader Memory Leaks. This is because the first call to the sun AppContext class makes a static reference to the current class loader.
> Same thing goes with the creation of the AWT Event Queue, as an example the use of the class java.awt.Color makes a static init call to java.awt.Toolkit which creates an AWT EventQueue despite the headless mode. The EventQueue also keep a reference to the current context with the class loader.
> The current work around I've found is to add a call to:
> {code}java.awt.Toolkit.getDefaultToolkit();{code}
> before the application gets loaded.
> This causes the EventQueue to be created and the AppContext to be initialized.
> Then, as the AWT static references are final, I get rid of this issue for the rest of the server lifecycle.
> I put this code in org.jboss.as.server.Main, just after line 91. However a proper solution would be to use org.apache.catalina.core.JreMemoryLeakPreventionListener which is present in the JBoss Web jar but not used... (cf. https://community.jboss.org/thread/164760 ) However the Tomcat code deals only with the AppContext, not the EventQueue!
--
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