Re:For Better Computing, Liberate CPUs from Garbage Collection
by apta on Thursday May 09, 2019 @05:07AM
(#19866557)
While RAII is a very good technique, it is not the solution to all issues here. I read that some concurrent datastructure implementations would not be possible without a GC. Furthermore, when a project reaches a certain level of complexity, it ends up implementing GC anyway (see Unreal engine).
[ Parent
| on HN ]
Re:For Better Computing, Liberate CPUs from Garbage Collection
by Patient0 on Thursday May 09, 2019 @05:26AM
(#19866649)
I agree that RAII does not solve everything - in particular, issues with memory fragmentation. However, I prefer the direction being taken by Rust and suggested by the top level poster: rather than having to run a separate thread which tries to infer which resources are no longer needed, with potentially large runtime costs, instead augment the language semantics with a clear ownership model, and thereby give the compiler enough information to generate code that runs in a stable, predictable memory footprint.
Re:For Better Computing, Liberate CPUs from Garbage Collection
by seanmcdirmid on Thursday May 09, 2019 @07:19AM
(#19867119)
That reminds me of the VILW argument: we will make languages really expressive and compilers really smart, then we can get rid of fancy CPU hardware that do instruction scheduling dynamically.
It doesn’t always work. A dynamic tracing GC (or reference counting or using arenas) can be more efficient in ways that static approaches probably won’t be able to effectively emulate. Rust is a great experiment for seeing how far we can go in this area, so we will see.
Re:For Better Computing, Liberate CPUs from Garbage Collection
by eru on Thursday May 09, 2019 @06:39AM
(#19866936)
RAII has nothing to do with memory fragmentation.
Solving memory fragmentation requires moving objects around. Usually you get that via a moving (or compacting) garbage collector. But there's no reason RAII style resource allocation couldn't move things around.
And there are plenty of garbage collection strategies that don't move objects around.