[squeak-dev] The Inbox: System-edc.512.mcz

Bob Arning arning315 at comcast.net
Mon Jan 21 23:05:09 UTC 2013


Perhaps in neat and tidy situations, but I invite your comments on

test1
"
ThreeGCTest test1
"
     | object registry other say |

     Smalltalk garbageCollect.
     Transcript cr.
     say _ [ :str |
         Transcript show: Smalltalk garbageCollect asStringWithCommas,' 
',str; cr
     ].
     say value: 'start'.
     registry := WeakRegistry new.
     object := Object new.
     other _ String new: 1024*102*16.
     registry add: object executor: (ObjectFinalizer
         receiver: [other _ nil]
         selector: #value).
     say value: 'created'.
     object := nil.
     say value: 'gc1'.
     say value: 'gc2'.
     say value: 'gc3'.

which produces:

505,963,044 start
504,291,464 created
504,291,360 gc1
505,962,536 gc2
505,962,428 gc3

Cheers,
Bob

On 1/21/13 3:28 PM, Bert Freudenberg wrote:
> On 21.01.2013, at 14:05, commits at source.squeak.org wrote:
>
>> 3 timesRepeat: [ Smalltalk garbageCollect].
> Doing this 3 times is superstitious. It won't clean up more than doing it once.
>
> IMHO an explicit GC is not necessary at all - what purpose does it serve?
>
> - Bert -
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130121/d861cf38/attachment.htm


More information about the Squeak-dev mailing list