4 ms·
> requires (manual) ownership tracking Have you tried RAII? Would you like to know more? https://stackoverflow.com/questions/2321511/what-is-meant-by-resource
by shepardrtc 5y ago
> requires (manual) ownership tracking
Have you tried RAII?
Would you like to know more?
https://stackoverflow.com/questions/2321511/what-is-meant-by-resource-acquisition-is-initialization-raii https://stackoverflow.com/questions/2321511/what-is-meant-by...
- simiones 5y agoRAII is exactly what I mean by "manual ownership tracking and deterministic destruction". RAII is better than completely manual memory management (C style malloc/free), but it still requires you to design your program such that every piece of memory is owned by some pointer with the correct properties. You have to choose between copying, bare pointers/references, unique_ptr and shared_ptr whenever two pieces of data are related to each other, or whenever you pass a piece of data to another function. Rust is a little better since at least the ownership concept is known to the compiler and automatically enforced. (Tracing/Copying/Compacting) GC is much easier since this entire concept goes away. You always pass references to data, and the physical storage is "owned" by the GC itself. It's also much faster for certain workflow patterns, though it always consumes more memory than deterministic destruction schemes.