Some memory leaks are logic errors, and this is honestly the irony of modern dynamic languages. I have actually gotten into the argument in interviews before - it is arguably safer (and better) to work from maximal static memory allocations with memory safe data objects than it is to implement dynamic memory algorithms just because they are fun coding problems.
Comment on How One Uncaught Rust Exception Took Out Cloudflare
Noja@sopuli.xyz 20 hours agoMemory leaks are logic errors, Rust can’t really prevent you from leaking memory.
socsa@piefed.social 19 hours ago
calcopiritus@lemmy.world 19 hours ago
It’s really hard to do without Rc (or similar) or unsafe.
Mechanize@feddit.it 18 hours ago
You can leak data in perfectly safe Rust, because it is not a bug per se, an example is by using Box::leak
Preventing memory leaks was never in the intentions of Rust. What it tries to safeguard you from are Memory Safety bugs like the infamous and common double free.