Rainer Deyke, el 18 de abril a las 16:18 me escribiste: > 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. > > It can't be handled by the GC either, because: > - This would require a high-level wrapper that knows about the "bye" > packet around a low-level socket that doesn't know. By the time the > high-level wrapper is finalized, the low-level socket may already have > been collected.
I don't know what you are talking about, I'm talking about this: class X { //... ~this() { socket.send(bye_packet); socket.close(); } > - It is bad form to wait for the next garbage-collection cycle before > cleanly terminating connections. > > What you need is RAII, not garbage collection. I'm talking about long lived resources for example. I don't understand people defending non-guaranteed finalization over guaranteed finalization, even when it's: a) Possible b) Easy to do c) Probably more efficient to terminate the program than the "safe" fullcollect() I really don't get it. Seriously. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Hey you, out there on your own Sitting naked by the phone Would you touch me?