News for hackers. Stuff that matters.
Re:For Better Computing, Liberate CPUs from Garbage Collection by norswap on Thursday May 09, 2019 @12:07PM (#19869488)
I mostly agree with your point on RAII.

But I don't think OP was advocating RAII.

The typical argument for GC is that it is less error-prone than even RAII. And I agree with that point. It's a trade-off on which you have to decide on. I think the tiny perf penalty is often worth it.

You can still retain stale data under a GC, but real leaks (unreachable allocated memory) are precluded — which is usually considered (not unreasonably) to be the more common and serious problem.

I think GC is a sane default because it's less error prone, and god knows the average developer will make enough errors as it is. I'd trust myself with manual memory management, but not a random group of developers I don't know. What about you?

Re:For Better Computing, Liberate CPUs from Garbage Collection by nine_k on Thursday May 09, 2019 @09:56PM (#19874395)
You can of course introduce a space leak in a honest GC environment. Make a linked list, and keep adding items to it while keeping its head referenced. Of course you do it by mistake: you kept two references, the main and the auxiliary, and the main reference is duly gone.

This is why weak references were invented.