I've looked at implementation of cleanCopy. It removes sender, but my 
problem is with receiver.

However I wrote similar set of methods that also set receiver to nil. 
Seems to work fine, in debugger such blocks are seen as defined in DoIt.


On 29.12.2015 3:42, Mariano Martinez Peck [via Smalltalk] wrote:
> This is halt related, but you can see how Fuel checks wether the closure
> is "clean" and if true, it serializes a pruned version of it so that to
> avoid a whole stack. See BlockClosure >> fuelAccept:
>
> fuelAccept: aGeneralMapper
>
> ^ self *shouldBeSubstitutedByCleanCopy*
> "The 'onRecursionDo:' is just to avoid an infinitive loop for the
> substitution. The cleanCopy MUST be a clean copy so it can be serialized
> normally"
> ifTrue: [ aGeneralMapper visitSubstitution: self by: *self cleanCopy
> *onRecursionDo: [ aGeneralMapper visitVariableObject: self ]  ]
> ifFalse: [ aGeneralMapper visitVariableObject: self ]




--
View this message in context: 
http://forum.world.st/Blocks-that-don-t-leak-memory-tp4868529p4868838.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to