Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Any connection between GC and Dispose()?
Any connection between GC and Dispose()? [message #443888] Mon, 04 October 2004 08:33 Go to next message
Benjamin Pasero is currently offline Benjamin PaseroFriend
Messages: 337
Registered: July 2009
Senior Member
Hi,

I am wondering if there is a connection between Java Garbage Collector and
the dispose() Method. As far as I know, the GC will free ressources on
Objects that are no longer referenced by any other Object or Class. How is
dispose() working? Let's say I am storing an Image in a field of an Object
that is still referenced. Are the ressources of the Image freed, or do I
also have to explicitly set all references to that Object to NULL?

Thanks,
Ben
Re: Any connection between GC and Dispose()? [message #443892 is a reply to message #443888] Mon, 04 October 2004 12:55 Go to previous messageGo to next message
Tiberiu Caprita is currently offline Tiberiu CapritaFriend
Messages: 68
Registered: July 2009
Member
Hi,
As long as I correctly understood, there is no connection between
GarbageCollector and <EclipseObject>.dispose() method (dispose() == just a
function name).

dispose() Method is either automatically called when Display.dispose() is
run (I think on Display.close()), either is the User responsabilty to do
it.
SWT Image is a Object among those belonging to User responsability to
Dispose it (see eclipse doc, there is clear written if a Object is
disposed when at parent disposing time).

If you want "automatically" Image disposing, use jface ImageRegistry: take
a look there is just a listener of Display when is disposing, in order to
release Images registered. Also for Colors you have such a help class, for
other resources you have to build it alone (Cursor I think).

Regards,
Tiberiu


> Hi,

> I am wondering if there is a connection between Java Garbage Collector and
> the dispose() Method. As far as I know, the GC will free ressources on
> Objects that are no longer referenced by any other Object or Class. How is
> dispose() working? Let's say I am storing an Image in a field of an Object
Re: Any connection between GC and Dispose()? [message #443898 is a reply to message #443892] Mon, 04 October 2004 13:29 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
See also:
http://eclipse.org/articles/swt-design-2/swt-design-2.html

This article describes the rules for using dispose.

"Tiberiu Caprita" <capritat@hotmail.com> wrote in message
news:cjrh8v$5kt$1@eclipse.org...
> Hi,
> As long as I correctly understood, there is no connection between
> GarbageCollector and <EclipseObject>.dispose() method (dispose() == just a
> function name).
>
> dispose() Method is either automatically called when Display.dispose() is
> run (I think on Display.close()), either is the User responsabilty to do
> it.
> SWT Image is a Object among those belonging to User responsability to
> Dispose it (see eclipse doc, there is clear written if a Object is
> disposed when at parent disposing time).
>
> If you want "automatically" Image disposing, use jface ImageRegistry: take
> a look there is just a listener of Display when is disposing, in order to
> release Images registered. Also for Colors you have such a help class, for
> other resources you have to build it alone (Cursor I think).
>
> Regards,
> Tiberiu
>
>
>> Hi,
>
>> I am wondering if there is a connection between Java Garbage Collector
>> and
>> the dispose() Method. As far as I know, the GC will free ressources on
>> Objects that are no longer referenced by any other Object or Class. How
>> is
>> dispose() working? Let's say I am storing an Image in a field of an
>> Object
>
>
Previous Topic:Emacs integration into Eclipse.
Next Topic:shell-Problem when using SWT 3.1 Mx
Goto Forum:
  


Current Time: Thu Sep 19 05:18:54 GMT 2024

Powered by FUDForum. Page generated in 0.03501 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top