[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-dev] Finalizers
On 11/25/06, Ryan Brown <ryan@xxxxxxxxx> wrote:
I've been working with finalization system, and I've run into a
problem. First, are finalizers actually intended for use? I can't
find anything in SC that uses them.
Finalizers were used in earlier versions of SC and later abandoned
because of impact on real time-ness of the garbage collector. I
recommend not using finalizers. This code should be removed.
The problem I'm having is that the finalize function will
occasionally be called in the middle of a chain of messages. For
g = NSColor.alloc.init;
Here the finalize function will be occasionally be called between the
alloc and the init. NSColor.alloc's return value isn't referenced at
The object is referenced on the stack.
so it makes sense that it is getting collected, but I
can't imagine this being the correct behavior. This example works
fine when it is separated into:
g = NSColor.alloc;
g = g.init;
I'm setting up the finalizer using InstallFinalizer().
You have declared a slot in the object for the finalizer?
sc-dev mailing list
--- james mccartney