[
https://issues.apache.org/jira/browse/PIVOT-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13582320#comment-13582320
]
Roger Whitcomb commented on PIVOT-861:
--------------------------------------
Hi Sandro,
Noel suggested privately just making ListenerList<T> use
java.lang.ArrayList<T> as a base, and save even more code. So, I'm thinking
about that.
Using this code and your workaround #2, I was getting the error a lot, and I
guess I didn't see the leak with the "btn_grid" test, but I didn't think that
your workaround was actually getting to the root of the problem (plus getting
the error messages). :)
I guess I don't mind making a method to do the whole dance of the "get from
cache, then if not found, load the image and put into cache" into a helper
method. That seems fine as you suggest. But I don't think it is necessary to
put the cache.put inside the try / catch since it doesn't throw any exceptions
that would be caught .....
I will respond to the other part of the problem in PIVOT-894..... But, I
think I have a solution for that.
> 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
> Labels: cache, image, leak, listener, memory
> 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