On Wed, Jul 31, 2013 at 6:31 AM, Henrik Johansen <
henrik.s.johan...@veloxit.no> wrote:

>
> 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.
>
>
Nice!!! I never tried with a different executor nor other instance of
WeakRegistry. That's cool. Thanks Henry.


> Cheers,
> Henry
>



-- 
Mariano
http://marianopeck.wordpress.com

Reply via email to