Advice wanted on garbage collection of sockets for c++ programmer using D
Guillaume Piolat via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 28 02:16:22 PDT 2017
On Wednesday, 28 June 2017 at 02:13:10 UTC, Jonathan M Davis
wrote:
> There are definitely cases where finalizers make sense. Case in
> point: if you have a socket class, it makes perfect sense for
> it to have a finalizer. Yes, it's better to close it manually,
> but it will work just fine for the GC to close it when
> finalizing the class object so long as you don't use so many
> sockets that you run out before the GC collects them. So,
> having a finalizer is a good backup to ensure that the socket
> resource doesn't leak.
>
> - Jonathan M Davis
So far everyone is ignoring my example when A needs B to be
destroyed. This happens as soon as you use DerelictUtil for
example.
More information about the Digitalmars-d-learn
mailing list