[ 
https://issues.apache.org/jira/browse/PIVOT-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13581828#comment-13581828
 ] 

Roger Whitcomb commented on PIVOT-861:
--------------------------------------

So, after using this new code and debugging through the PivotApp861.java 
program, there are several things I see here:
1) Each time you load the "btn_grid.xml" it creates 9 new ButtonDataRenderer 
objects, each with a new ImageView.
2) So, even though the same image is loaded from the Application's resource 
cache, there is a new ImageViewSkin that is added to the Image's ListenerList 
for each button.
3) If I remove the (nine) <dataRenderer> ... </dataRenderer> blocks from the 
"btn_grid.xml" file then there is no longer a memory leak.
4) The real problem, then, is two-fold:  
    a) The example is creating ButtonDataRenderer objects that it doesn't need 
to.
    b) There needs to be a way for a Renderer not to participate in the 
listener list for ImageView because it is not necessary (because the image is 
transient by definition, being set by every call to "render").  This will need 
some thought as to how to make ImageView work with transient images.
                
> Memory leak: Window icon ImageListenerList retains reference to closed 
> windows, preventing garbage collection
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-861
>                 URL: https://issues.apache.org/jira/browse/PIVOT-861
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk, wtk-media
>    Affects Versions: 2.0.2
>         Environment: Windows XP, Java 1.7.0_05
>            Reporter: David Keen
>            Assignee: Sandro Martini
>             Fix For: 2.0.3
>
>         Attachments: leaktest.zip, Pivot861.launch, PivotSample.zip
>
>
> When a window or dialog is opened which has an icon, after it is closed it 
> cannot be garbage collected because a reference is retained to it through the 
> icon.  Removing the icon resolves the issue.
> As far as I've investigated, the issue appears to the in the 
> ImageListenerList which each Image contains.  I've done a heapdump of my 
> application and used the IBM HeapAnalyzer which shows this list containing a 
> reference to the window/dialog through the ImageViewSkin, but I don't know 
> the Pivot internals well enough to see where or how it should be released.
> I'll attach a simple test application to show the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to