On Jul 31, 2013, at 3:23 , Mariano Martinez Peck <marianop...@gmail.com> wrote:
> As far as I know, that's not possible in Pharo unless you explicitly register > the desired objects in "WeakRegistry default" or similar (and implement > #finalize). > I think is the closest you have. > > Cheers, A few clarifications: - You can use a non-default WeakRegistry (usually one specific to your domain, to avoid cluttering of the default one) - You can specify a custom executor (any object which implements #finalize), rather than implement #finalize on objects you're interested in. obj := Object new. executor := ObjectFinalizer receiver: Transcript selector: #show: argument: 'Object GC''d!'. myReg := WeakRegistry new. myReg add: obj executor: executor. obj := nil. Smalltalk garbageCollect. Cheers, Henry