3 ms·
Nit: Rust doesn't prevent memory leak.
by nialv7 10y ago
Nit: Rust doesn't prevent memory leak.
- kevincox 10y agoIt makes it much more difficult. In fact safe rust provides similar guarantees to garbage collected languages as the heap-allocated classes will clean themselves up.
- nialv7 10y agoNot if they have circular references... (I agree that Rust makes it difficult to do this accidentally) Also, remember mem::forget() is not unsafe I'm pointing this out because I don't want people to have wrong expectation of Rust. Rust doesn't prevent memory leak. Rust doesn't consider memory leak to be "unsafe". Even the Rust team themselves have pointed this out multiple times. Somehow people are still repeating that Rust can rid you of memory leaks. And I'm downvoted just because I'm pointing out facts. Sigh.
- steveklabnik 10y agoIt is unfortunate you're downvoted for making a true statement. It's extremely important that people don't see Rust as a panacea.
- topspin 10y agoFortunately it appears this perfectly legitimate comment has been salvaged. Steve, I was disappointed that this topic[1] received no discussion at all at HN. Has anyone inside Mozilla looked at it? The title is a bit click-baity for academic work, in my opinion, but I do think the points raised are worthy. Much like recent criticism of PostgreSQL by Uber, one hopes the purveyors of Rust are also open and respond well to constructive criticism. 1. https://news.ycombinator.com/item?id=12258957 https://news.ycombinator.com/item?id=12258957
- steveklabnik 10y agoIt wasn't discussed a lot because it's quite old, and we talked about it a lot when it was published. I actually met (and then became friends with) Amit in real life because of this paper; we're both in New York and got coffee to discuss it. (It's been a while, but IIRC the issues they had were more about not understanding what exacty was available and how to use them, at the time. The project has been going really well since then; Amit has been giving a number of cool talks about it at various Rust user groups, and they recently started their own "This week in", though it's called "Talking Tock" because that's a better name, ha!)
- binarycrusader 10y agonit: while rust doesn't prevent all memory leaks, it does prevent some classes of memory leaks; especially when compared to C, since it requires you to annotate the lifetimes of data and automatically manages many types of allocations by scope and lifetime