Cool. I'll create the report in JIRA. I started looking through the code in 
SVN. I haven't done Eclipse plugin dev in a long time, and can't take the time 
to learn/setup a plugin dev environment right now.  Maybe in a week or so.

Just looking through code in SVN trunk though, I doesn't look like the label 
images used in the tree are ever being disposed.  The ImageManager creates the 
image here:

public static Image getImage(String filename) {
  |             if (null == filename) return null;
  |             ImageDescriptor temp = getImageDescriptor(filename);
  |             if(null!=temp) {
  |                     return temp.createImage();
  |             } else {
  |                     return null;
  |             }
  |     }

They get used in OutlineLabelProvider here:

public Image getImage(Object anElement) {
  |             if (null == anElement)
  |                     return null;
  |             if (anElement instanceof Item) {
  |                     return ImageManager.getImage(((Item) 
anElement).getTreeImage());
  |             }
  |             else {
  |                     return null;
  |             }
  |     }

And from what I can see, they are never disposed.  My guess is that the outline 
labels are reconstructed quite often, and so more and more images get created 
but never disposed.

Assuming SWT images are immutable and can be reused, the fix could be as simple 
as modifying OutlineLabelProvider to cache the images in a map by filename. 
Then, making sure they are reused on every call to the provider. (Should also 
dispose them when the OutlineLabelProvider is disposed, but if the images are 
being reused, it probably doesn't matter much.) 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205103#4205103

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205103
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to