[Newbies] How to empty a collection?
janko.mivsek at eranova.si
Tue Feb 19 21:03:24 UTC 2008
This method is mine :) Ok, with a little IRC help from Radoslav Hodnicak.
Why #become: ? As Marcin already suggested is a problem how to nil all
existing elements in a collection, so to be garbage collected. This is
specially problematic when collection has many elements and just doing
an usual remove is too slow. In that case #become: is much faster, even
that this method is slow on some dialects. Also, collection identity is
preserved. But main point is that all elements are for sure GCed!
Marcin Tustin wrote:
> My own testing suggests that references to the object remain in place. I
> would guess that that is the whole point of become.
> > Isn't Cedrick's aida solution going to be significantly faster?
> this is not mine :)
> butI'd interested to see if it's a good use of #become:... Does it
> keep references ? is it safe ?
Smalltalk Web Application Server
More information about the Beginners