What would be the appropriate description for Rust's memory model? Automatic scoped memory management with opt-in reference counting?
What would be the appropriate description for Rust's memory model? Automatic scoped memory management with opt-in reference counting?
Memory management is the correct term. Rust the language does not do any memory management: memory management is a feature of the standard library. I would say that the Rust standard library (the `alloc` crate specifically) provides types that safely encapsulate allocation and deallocation of memory.
This is enabled by automatic destructor calls on stack-allocated variables when they go out of scope. (However, note that destructors need not deallocate memory).
Again, this part works exactly the same in C++. In C++ when a type's constructor acquires some resource, and its destructor releases that resource (in this case the resource being memory) it is referred to as "Resource Acquisition Is Initialization" or RAII.
And to certain extent, C++ has influenced Turbo Pascal/Delphi as well with similar approach.