[ 
https://jira.jboss.org/jira/browse/RF-4471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12464710#action_12464710
 ] 

Alexander Schwartz commented on RF-4471:
----------------------------------------

This code sample keeps away the Java2D Disposer and the AWT Windows thread. 
They only appear when you have i.e. rendered images in richfaces tabs. But 
beware: these images are cached, so you will get the threads only when you 
force a reload.

  @Create
  public void startup() {
    Thread thread = Thread.currentThread();
    ClassLoader initialTCCL = thread.getContextClassLoader();
    try {
      ClassLoader systemCL = ClassLoader.getSystemClassLoader();
      thread.setContextClassLoader(systemCL);
      this.getClass().getClassLoader().loadClass(
          "org.ajax4jsf.resource.ResourceBuilderImpl").newInstance();
      this.getClass().getClassLoader().loadClass("sun.java2d.Disposer")
          .newInstance();
      // start AWT Windows thread
      Toolkit.getDefaultToolkit().getSystemEventQueue();
    } catch (...) {
      ...
    } 
  }
  


> Usage of ImageIO in ResourceBuilderImpl causes memory leak
> ----------------------------------------------------------
>
>                 Key: RF-4471
>                 URL: https://jira.jboss.org/jira/browse/RF-4471
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.1.6
>         Environment: any
>            Reporter: Philipp Schoepf
>            Assignee: Nick Belaevski
>             Fix For: 3.3.1
>
>
> It seems as we found a memleak in the ResourceBuilderImpl class. The call to 
> ImageIO.setCache(false)
> causes sun.awt.AppContext to statically initialize itself (inside static 
> initialization of IIORegistry). The problem is that AppContext seems to hold 
> a static reference to the contextclassloader of the calling thread. When our 
> application gets undeployed the reference to the applications classloader is 
> still hold by AppContext causing that loaded classes cannot be garbage 
> collected.
> I only checked richfaces 3.16 but if ResourceBuilderImpl still exists in 3.2 
> stream I suppose that the problem exists there as well.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to