On 23 April 2013 14:17, Sean P. DeNigris <sean@clipperadams.com> wrote:but what you expecting?
> 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...
you refer to 'self' multiple times. sure thing it cannot be GC-ed,
neither process will die because
of plenty of references on stack.
Even block closure which you creating for fork will have home context
which keeps reference to 'self',
e.g. receiver.
> 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.
>
--
Best regards,
Igor Stasenko.