cyclic looping with [0 == object] whileFalse: [object
reefedjib at yahoo.com
Tue Nov 6 00:15:07 UTC 2007
----- Original Message -----
From: "John M McIntosh" <johnmci at smalltalkconsulting.com>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Monday, November 05, 2007 11:18 AM
Subject: Re: cyclic looping with [0 == object] whileFalse: [object
> On Nov 5, 2007, at 10:44 AM, Rob Withers wrote:
>> I thought of a possibility. It could be that I am creating objects
>> (BlockContexts and MethodContexts) as fast as I process them in this
>> loop. If the loop is creating objects, then they are bound to be at the
>> end of memory and I am bound to not be able to catch up to them. In
>> this case, my #ifTrue: msg is a real msg creating a real BlockContext
>> each time through the loop, because of my Compiler changes, and the
>> associated MethodContexts are being created too. (My addition of
>> anOrderedCollection>>#add:/#addLast:/ #grow... are being recorded as
>> well). Each time through a new instance of the BlockContext is being
>> That sucks. I can't do anything about it.
> As an optimization methodContexts are recycled and reused, this feature
> decreases the time take
> to make a new context. When a method returns the local context is then
> stuffed onto the free context chain.
> However on a GC the free context chain is GCed also. So usually you are
> not making a new object (MethodContexts ) for the message activation.
In my test code, I am stuffing each object into an OrderedCollection, so
they won't be recycled for sure. I'll try printing them to the transcript
to detect a 'cycle', but not hang on to them.
The question remains with the original code, which is not saving each
object, why it is stuck processing more and more objects. As I said, I
changed the compiler to stop inlining #ifTrue: and this was the result of
that (after recompileAll). I would like to find out why, and see if it is
something I have done wrong with #ifTrue: msg sending.
Is it as Mathieu Suen says? Are they getting trapped in the stack?
More information about the Squeak-dev