4 ms·
I would argue RAII is still a type of automatic memory management, but it has the determinism and ability to reason about what's going on the same way fully man
by connicpu 4y ago
I would argue RAII is still a type of automatic memory management, but it has the determinism and ability to reason about what's going on the same way fully manual management does.
- kaba0 4y agoFrom the Garbage Collector handbook I got a very great quote about what automatic memory management really is. I will butcher it up, but the basic essence is that automatic memory management is above all a software design tool — well designed programs are built from components that are highly cohesive but loosely coupled. What it means for memory management is that a component shouldn’t have to care about how other modules handle memory for correct working. This is possible with a GC, but isn’t with manual memory management, and RAII doesn’t change it — function signatures leak memory management concerns in both Rust and C++. Ongoing refactoring and maintenance costs are also higher in low-level languages due to this reason.