GC object finalization not guaranteed

Leandro Lucarella llucax at gmail.com
Sat Apr 18 13:42:04 PDT 2009


Don, el 18 de abril a las 22:25 me escribiste:
> >The current GC implementation don't call finalizers for data that's still
> >reference when the program *ended* (this is allowed by the specs, so it's
> >fine, the question is why it's allowed by the specs).
> 
> I don't understand why D even has finalizers. Can they do anything useful?

Close a connection gracefully for example, I guess (I mean, send a "bye"
packed, not just close the socket abruptly). Same for closing files
writing some mark or something. They can be risky when finalization is not
deterministic though.

Of course that can be done manually if you are well organized when
programming, but then, you can do that with memory too, and the whole GC
loose its usefulness, so I guess is a valid argument for other things 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)
----------------------------------------------------------------------------
Vaporeso sostenía a rajacincha la teoría del No-Water, la cual le
pertenecía y versaba lo siguiente: "Para darle la otra mejilla al fuego,
éste debe ser apagado con alpargatas apenas húmedas".



More information about the Digitalmars-d mailing list