GC object finalization not guaranteed
Leandro Lucarella
llucax at gmail.com
Sun Apr 19 09:48:35 PDT 2009
Christopher Wright, el 18 de abril a las 22:06 me escribiste:
> Walter Bright wrote:
> >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.
>
> That requires more work -- you have to keep track of a bunch of
> instances that are active, and then the static destructor goes through
> all of them and nukes them each in turn. It isn't a whole lot of work,
> I admit. But it is -- or at least, it is perceived as -- an idiom to
> make up for an inadequacy of the garbage collector.
>
> >Finalizers are fairly useless for gc. But they are a lot more useful as RAII destructors.
>
> Then maybe finalizers should be divorced entirely from garbage collection.
Tha's an option too, but I think it's more useful to provide guaranteed
finalization, which is very doable too.
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
When I was a child I had a fever
My hands felt just like two balloons.
Now I've got that feeling once again
I can't explain you would not understand
This is not how I am.
I have become comfortably numb.
More information about the Digitalmars-d
mailing list