3 ms·
Being able to talk about memory allocation in a safe way is one of the key objectives of Rust. Rust is the only modern language (i.e. not C or C++) I know of th
by noelwelsh 13y ago
Being able to talk about memory allocation in a safe way is one of the key objectives of Rust. Rust is the only modern language (i.e. not C or C++) I know of that allows one to mix GC'ed and manually allocated memory, and heap and stack allocated memory.
Reasoning about mutability is necessary for safe (and fast!) concurrency.
- masklinn 13y ago> Rust is the only modern language (i.e. not C or C++) I know of that allows one to mix [...] heap and stack allocated memory. Technically I believe (to verify) Go does that as well, but the mix is implicit and the system (not the developer) will decide on its own whether a value should be stack- or heap-allocated. C# will also allocate value types local variables on the stack (technically all local variables are stack-allocated, but for reference types it obviously stack-allocates a reference to the heap, the end-result is that under the usual understanding of "stack allocation" only value type local variables and parameters are stack-allocated)
- pcwalton 13y agoYou can do it in D as well in much the same way as in C#. (You can get manual memory management with heap allocation as well, but you lose the safety then.)
- pkolaczk 13y agoJVM HotSpot does this, too, implicitly, by means of EscapeAnalysis.
- noelwelsh 13y agoBy "Being able to talk about memory allocation" I meant that the programmer has control over these things.