GC question

osa1 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 4 08:04:32 PST 2017


> All GCs are prone to leak, including precise ones. The point of 
> garbage collection is not to prevent leaks, but rather to 
> prevent use-after-free bugs.

Of course I can have leaks in a GC environment, but having 
non-deterministic leaks is another thing, and I'd rather make 
sure to delete my references to let GC do its thing than to pray 
and hope some random number on my stack won't be in the range of 
my heap.

I don't agree that the point is just preventing use-after-free, 
which can be guaranteed statically even in a non-GC language (see 
e.g. Rust).


More information about the Digitalmars-d-learn mailing list