3 ms·
> Are you suggesting that memory leaks don't happen in Rust? Their wording was "would be unlikely", rather than "don't happen". The affine(ish) type system, al
by whytevuhuni 2y ago
> Are you suggesting that memory leaks don't happen in Rust?
Their wording was "would be unlikely", rather than "don't happen". The affine(ish) type system, along with lifetimes, makes it so most objects have a single owner, and that owner always knows it is safe to deallocate.
> for some reason seems to define memory leaks as safe behavior
The reason is that Rust aims to prevent undefined behavior, and that is the only thing it defines as unsafe behavior.
Memory leaks cannot cause a program to, for example, start serving credit cards or personal information to an attacker. Their behavior is well defined (maybe over-complicated thanks to Linux's overcommit, but still well defined).
Rust does not protect against DoS attacks in any way. In fact it seems to enjoy DoSing itself quite a lot given how many things panic in the standard library.