On 04.06.2008, at 10:32, Klaus D. Witzel wrote:

On Wed, 04 Jun 2008 09:55:11 +0200, Norbert Hartl wrote:

The objects are still referenced in the collection you get
from self selected. The line with "each := nil" is useless
as each is only a temporary variable.

Not 100% useless, since temporary variables (and arguments, for that matter) survive any attempt, from within the same method, to garbage collect them:

{'this ', 'and ', 'that'} collect: [:each | ].
Smalltalk garbageCollect.
{thisContext tempAt: 1} inspect

first line: create some object and make a temp var point to it.
second line: invoke GC.
third line: see what's still pointed to by the temp var.


Yikes. Klaus, please keep the hair-splitting to squeak-dev if possible.

Assigning to a block parameter is just wrong. Setting temps to nil is unnecessary in any normal method. If your code actually needs to worry about this, then you left the beginner playground.

Rob: Here's a recipe to find out what is keeping your instances from being garbage-collected:

http://wiki.squeak.org/squeak/2631

- Bert -


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to