> But if you want to be sure, then set t = null; after the call to goo
And (assuming everything is syncronous) if you REALLY want to be in
control, call the garbage collector explicitly:
System.gc();
/Casper
Alex Molochnikov - 25 May 2005 16:53 GMT
> > But if you want to be sure, then set t = null; after the call to goo
>
[quoted text clipped - 4 lines]
>
> /Casper
... Except that the GC will never let you be in control. The call to
System.gc() is only a _suggestion_ to JVM to run the garbage collector. The
JVM may or may not do it on your request. Also, setting t to null is
superfluous. Once t goes out of scope in the given example, all references
to it are gone, and it becomes eligible for the collection - whether it was
nulled out or not.
>>Hello!!
>>
[quoted text clipped - 18 lines]
>
> Claus
It depends also on what goo() does. If goo() stores a reference
somewhere t may not be eligible for GC.
Ray

Signature
XML is the programmer's duct tape.