Login  Register

Re: Finalization question

Posted by Schwab,Wilhelm K on Oct 23, 2009; 1:53pm
URL: https://forum.world.st/Finalization-question-tp1300962p1300965.html

Sig,

I think I am starting to understand.  One thing though: WeakRegistry is a singleton customized to be part of the finalizer??  Not sure I like that.  The name is too generic for the task.

If I am indeed following, it sounds as though what Dolphin does with a flag on the expired object, Pharo does using a shallow copy of or other executor for the expired object.  Does that sound like a reasonable paraphrasing?  I am not sure which design I prefer, but I should be able to fake up an appropriate #beUnfinalizable to make my code happy on Pharo.

Thanks!!

Bill


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Igor Stasenko
Sent: Friday, October 23, 2009 1:49 AM
To: [hidden email]
Subject: Re: [Pharo-project] Finalization question


a rough analogy is something like that:

Object>>beFinalizable
"A shallow copy of the receiver will receive a #finalize message, once the receiver become garbage"
  WeakRegistry default add: self


you can use #add:executor: and provide a custom executor for object.
An ObjectFinalizer  just a generic class provided for convenience.
Anyways, all of this stuff ends up in WeakRegistry, so its a question of personal taste, what to use.

Or, if you think you are hardcore, you can write own class which provides finalizatin services.
Then you can add it to:
WeakArray addWeakDependent: yourStuff.

And at each GC cycle, when finalization process will awake, your object will receive #finalizeValues mesasge, where you free to choose what to finalize and how.


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project