<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Sep 28, 2008 at 5:28 PM, Randal L. Schwartz <span dir="ltr">&lt;<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt;&gt;&gt;&gt;&gt; &quot;Andy&quot; == Andy Burnett &lt;<a href="mailto:andy.burnett@knowinnovation.com">andy.burnett@knowinnovation.com</a>&gt; writes:<br>
<br>
Andy&gt; Could some kind soul please explain what I am doing wrong here?<br>
Andy&gt; I have a model, called Fspace, which I have created several instances of,<br>
Andy&gt; whilst I was testing it.<br>
<br>
Andy&gt; Fspace allInstances size reports 9 instances.<br>
<br>
Andy&gt; When I run<br>
<br>
Andy&gt; Fspace allInstancesDo:<br>
Andy&gt; &nbsp; &nbsp;[:each |<br>
Andy&gt; &nbsp; &nbsp;each := nil.<br>
Andy&gt; Transcript show: (each value); cr.<br>
Andy&gt; &nbsp; &nbsp;Smalltalk garbageCollect]<br>
<br>
Andy&gt; The transcript shows that the values are set to nil. However, the instances<br>
Andy&gt; don&#39;t go away. &nbsp;So, what am I doing wrong?<br>
<br>
Setting &quot;each&quot; to &quot;nil&quot; there does nothing, since you aren&#39;t<br>
updating the object that was originally in &quot;each&quot;.<br>
</blockquote><div><br>This is a pretty common misconception. It seems to come up once a month. I wonder why - mostly it&#39;s not people who are new to programming, who I would expect to be unfamiliar with the distinction between an object or value and the location it is stored in.<br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
You need to tell anyone still holding a reference to your objects<br>
to let go. &nbsp;Some advice can be found at <a href="http://wiki.squeak.org/squeak/2176" target="_blank">http://wiki.squeak.org/squeak/2176</a><br>
<br>
--<br>
<font color="#888888">Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095<br>
&lt;<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>&gt; &lt;URL:<a href="http://www.stonehenge.com/merlyn/" target="_blank">http://www.stonehenge.com/merlyn/</a>&gt;<br>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.<br>
See <a href="http://methodsandmessages.vox.com/" target="_blank">http://methodsandmessages.vox.com/</a> for Smalltalk and Seaside discussion<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</font></blockquote></div><br></div>