[Newbies] Removing an object instance

Millet Stéphane smillet71 at free.fr
Mon Feb 12 21:07:26 UTC 2007


Thanks for the answer.
In fact, the object I was working on is a map which takes 400Mb, so when
I finish a test, I would prefer the object to be "removed". I will try
to force garbage collection as you proposed.


Herbert König a écrit :
> Hello Stéphane,
> s> I would like to know when an object created in aworkspace is deleted (garbaged).
> the simplified answer is, when the object is not referenced any more and
> the system decides to do a garbage collection.
> If you need something collected:
> Smalltalk garbageCollect
> will do just that.
> s> I then ask for MyWorldallInstances in another window and the value is 1.
> Actually the value is an array with one element.
> If you still find instances after an explicit GC you can inspect that
> array by MyWorld allInstances inspect.
> In the inspector you can right click (Win) on that element and select
> "objects pointing to this value" and find out who references your
> object.
> s> I don’t understand this behaviour. The objectshoudn’t be
> s> referenced or only by weak references, no ? 
> GC is time consuming so it's split up between incremental and full
> garbage collects. Both are scheduled when necessary (this is a big can
> of worms but documented on the swiki). So you can still find an
> object which is not referenced as long as no collection has occurred.
> Cheers
> Herbert                            mailto:herbertkoenig at gmx.net
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

More information about the Beginners mailing list