Community Forums

Home » Vuze Forums » Development » Bug Reports


Thread: SWT Images leaking in ImageRepository? (minor)


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Pages: 1 - Last Post: Jan 7, 2008 8:10 PM Last Post By: The 8472
yahave

Posts: 5
Registered: 12/26/07
SWT Images leaking in ImageRepository? (minor)
Posted: Jan 7, 2008 10:07 AM
  Click to reply to this thread Reply
Following some image leaks, I got down to the class ImageRepository.
It seems that it has a method unLoadImages as follows:

public static void unLoadImages() {
Iterator iter;
iter = images.values().iterator();
while (iter.hasNext()) {
Image im = (Image) iter.next();
im.dispose();
}

iter = registry.values().iterator();
while (iter.hasNext()) {
Image im = (Image) iter.next();
if(im != null)
im.dispose();
}
}

Unfortunately, this method is never called in Azureus, or at least I could not find a static call (maybe called via some tortured reflection, but not likely). This particular kind of leaks may be minor, as images in the repository are long-lived and cleanup can be only called once the application is shutting down. However, on an application restart (which is probably not used very frequently) this may be of some value.
Nevertheless, it's probably good practice to dispose of these images properly.

FIX: add a call to this cleanup method in MainWindow._dispose which is a cleanup method called when the main window is closed (possibly to be restarted!).
The 8472

Posts: 2,147
Registered: 11/13/07
Re: SWT Images leaking in ImageRepository? (minor)
Posted: Jan 7, 2008 8:10 PM   in response to: yahave in response to: yahave
  Click to reply to this thread Reply
application restart completely tears down the JVM and starts a new one to redo static initialization too, so that's not really an issue. The other thing is that we can't unload images anyway since they're shared by an unknown number of objects and closing the main window also tears down the JVM.

-> Currently not an issue, this might change if we'd make the UI unloadable in the future
Legend
Master: 200 - 999 pts
Expert: 150 - 199 pts
Advanced: 100 - 149 pts
Intermediate: 50 - 99 pts
Beginner: 10 - 49 pts
Newbie: 0 - 9 pts
Vuze Staff Member
Vuze Project Developer
Vuze Community Moderator
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums