3 ms·
> borrow checker ensures that I don't leak memory when not using unsafe Also to point out, you can 100% leak memory in safe rust
by 3a2d29 4y ago
> borrow checker ensures that I don't leak memory when not using unsafe
Also to point out, you can 100% leak memory in safe rust
- satvikpendem 4y agoYes, you're right. However, it's much harder than in other languages, and the likelihood of doing so therefore is lower. I can also leak memory in GC languages too, just to note.
- MrJohz 4y agoYou can 100% leak memory in pretty much every language though: just use a bad caching/memoisation strategy, and you'll have memory leaks for days. Leaking memory isn't in of itself a problem, and it can be a very valid strategy for short-lived programs where you can rely on the OS to do the ultimate garbage collection run anyway. It's only a problem in the sense that uncontrolled memory acquisition will inevitably lead to the system running out of memory to acquire, but that's also true if you're accumulating memory for perfectly legitimate reasons.