|
Re: Any connection between GC and Dispose()? [message #443892 is a reply to message #443888] |
Mon, 04 October 2004 12:55 |
Tiberiu Caprita 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 |
Veronika Irvine 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
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03501 seconds