I think it is as Camillo said: the Timer object holds the Process object the block in the Process holds the Timer object in its closure. the Process is held by the system
=> neither can become garbage Maybe Igor meant to not put the process in an instance variable… But I fear that won't do: the block closure keeps on referring to self, which is your timer. On 23 Apr 2013, at 14:17, "Sean P. DeNigris" <[email protected]> wrote: > Igor Stasenko wrote >> you don't need finalization.. just a weak reference. something like this: >> >> array := WeakArray with: myObject. >> >> [[ array first notNil] whileTrue: [ ...... ]] fork. > > Timer>>start > > | array | > array := WeakArray with: self. > process := [ > [ array first notNil ] whileTrue: [ > interval asDelay wait. > self value: self value + 1. > self announcer announce: (TimerValueChanged to: self > value) ] ] fork. > > Timer new start. > Smalltalk garbageCollect. > > The process is still there... > I'm attaching (to Nabble) a screenshot of #pointersTo > <http://forum.world.st/file/n4683095/Screen_Shot_2013-04-23_at_8.16.01_AM.png> > > > > > ----- > Cheers, > Sean > -- > View this message in context: > http://forum.world.st/Terminating-a-Process-when-an-object-dies-tp4683036p4683095.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. >
