Leandro Lucarella wrote:
You missed the point. I'm not talking about freeing the memory. I'm
talking about finalizers. A finalizer could send a "bye" packet throgh the
net. That can't be handled by the OS.

That shouldn't be handled by a finalizer. A "bye" packet can be handled by a static destructor.

And I'm not talking about doing a collection at program exit either. I'm
talking about just calling the finalizers.

The finalizers are found by doing a collection scan to see what's left, and then running the finalizers.


What I say is to do this (in some kind of pseudocode, which is actually
valid code in my example naive GC implementation =):

void gc_term()
{
        foreach (cell; this.live_list)
                rt_finalize(cell.ptr);
}

No collection, no free.

What do you think about that? And about finalizers being completely
useless if the excecution is not guarateed? I would really like to know
(Sean's opinion would be appreciated too, being in charge of druntime).

Finalizers are fairly useless for gc. But they are a lot more useful as RAII destructors.

Maybe this can be an improvement for D2 (I don't think you'll like to
change the specs for D1 =).

Reply via email to