Garbage Collection is Wrong
lb-stuff.com
Garbage Collection is Wrong
1–10 of 111 posts
Re: Garbage Collection is Wrong
#2Why is your nickname in green color?
Re: Garbage Collection is Wrong
#3Why is your nickname in green color?
Very fresh (16h old at the time I wrote this comment).
Re: Garbage Collection is Wrong
#4What's the catch?
Re: Garbage Collection is Wrong
#5Meh, GC has its uses. It helps that the vast majority of resources are indeed memory, so it makes sense to special-case.
Although in some situations it isn't acceptable and it's interesting to look at what languages like Rust do about it. It ends up guaranteeing safety, but with not much more effort than GC.
Re: Garbage Collection is Wrong
#6When was this written? It seems to be at least half a decade out of date. Certainly nothing it espouses is actually new...
Re: Garbage Collection is Wrong
#7Yes, in some scenarios you can associate the lifetime of a resource with the lifetime of a storage location, but this simply does not work in all cases, probably only in a small fraction of all cases. And then? How do you handle resources that have no single obvious owner? How do you determine if the resource is still in use when you are done with it in one place? You implement some kind of reference counting? You keep the resource alive until you reach a point where you definitely know it is no longer in use? You turn your code upside down and force it into a single owner structure destroying the semantics of your code on the way?
Re: Garbage Collection is Wrong
#8In modern C++, using new or delete in your code is wrong. It's not done. Nobody writes code like that anymore in C++.
It's been quite a while since I wrote any significant C++ code, but this statement seems wrong. Is this really "state of the art" for C++?
Re: Garbage Collection is Wrong
#9In modern C++, using new or delete in your code is wrong. It's not done. Nobody writes code like that anymore in C++. It's been quite a while since I wrote any significant C++ code, but this statement seems wrong. Is this really "state of the art" for C++?
In practice, no. People still write new and delete all the time in large C++ codebases (LLVM, Gecko, WebKit, etc. etc.)
unique_ptr is gaining traction, of course.
Re: Garbage Collection is Wrong
#10Sometimes GC is nice, sometimes it isn't. I like langs that give you options.