When to run SWTResourceManager.dispose()?

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

When to run SWTResourceManager.dispose()?

Postby riz1ali » Fri Oct 03, 2008 1:01 pm

Hi,

When is the best time to run SWTResourceManager.dispose()?

Should it be before the shell is disposed or before the display is disposed or when the shellClosed(ShellEvent) is fired?

Thanks.
riz1ali
 
Posts: 4
Joined: Thu Dec 06, 2007 1:55 pm

Re: When to run SWTResourceManager.dispose()?

Postby Eric Clayberg » Sun Oct 05, 2008 6:29 am

It doesn't really matter as long as you are done with all the cached resources.

Since we cache SWT resources and return the same instance when the app asks for a resource with the same parameters (for example, the same image), the only absolutely safe point is the end of the application.

But this means that the dispose() method is just a formality since the OS will free all the resources on process termination anyway.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests