[Newbies] How to get rid of objects...

Bert Freudenberg bert at impara.de
Tue May 9 16:08:33 UTC 2006


Am 09.05.2006 um 16:41 schrieb cdrick:

> Hi...
>
> I d like to know if there is a way to force garbage collection of  
> objects (still referenced)...

A still referenced object is never garbage-collected. You must cut  
the reference first, that is, write another object (like nil) into  
the variable that references your object.

Since it is a bit unpredictable *when* the garbage collector will  
collect your object after it is not referenced anymore, you can force  
a GC by "Smalltalk garbageCollect". However, this is mostly useful as  
an aid in debugging. Only when doing very specific tasks it is  
necessary to force a GC by code.

- Bert -



More information about the Beginners mailing list