CommandHistory class #forgetAllGrabCommandsFrom:

Andreas Raab andreas.raab at gmx.de
Tue Nov 6 00:37:32 UTC 2007


Rob Withers wrote:
> ----- Original Message ----- From: "Tom Phoenix" <rootbeer at redcat.com>
> 
>>
>>  CommandHistory class>>forgetAllGrabCommands
>>    Morph allSubInstancesDo: [:m |
>>      m removeProperty: #undoGrabCommand ].
> 
> Tom, this certainly looks better, but per John, it would be slower than 
> the loop with #nextObject.  This runs on every image startUp.
> 
> Plus I want to find out why my change caused such a disaster.

Check the allocation patterns. The following should do the trick:

   marker := Object new. "end marker"
   [marker == obj] whileFalse:[
     "... do whatever was here before ..."
     obj := obj nextObject.
   ].

   "Now we're running into the objects that were generated during the 
above loop. Create a second marker to guard against runaway and see what 
objects were created during the above loop"

   marker := Object new. "end marker"
   tally := OrderedCollection new: 10000.
   [marker == obj] whileFalse:[
     tally add: obj.
     obj := obj nextObject.
   ].

Cheers,
   - Andreas



More information about the Squeak-dev mailing list