Re:Rust means never having to close a socket
by wycats on Tuesday October 07, 2014 @02:28PM
(#8422984)
In Rust, you often use stack allocation, which, as you pointed out, is much more efficient. There's some heap allocation in Rust, but in my experience it's actually a minority of all allocations.
Rust also has an Arena library (http://doc.rust-lang.org/0.11.0/arena/index.html), which can be used for cases where you know that you have enough memory for a given operation and are willing to throw out the entire thing when the operation (or program ;) ) is done.
Re:Rust means never having to close a socket
by eddyb on Wednesday October 08, 2014 @04:01AM
(#8425754)
That link is outdated, see http://doc.rust-lang.org/arena/.
Of course if your program is short-lived you can just allocate a sufficiently large heap, pointer bump the whole way and free all non-memory resources on program termination, which ought to be cheaper (but probably not that much in practice due to cache effects).