2 ms·
It's not wrong. I didn't mean to imply that. I just mean that saying non-GC languages are about performance overhead of the garbage collector is missing the poi
by ragnese 6y ago
It's not wrong. I didn't mean to imply that. I just mean that saying non-GC languages are about performance overhead of the garbage collector is missing the point.
Sometimes, it's convenient and easier to reason about stuff when you can predict when something is actually dropped from memory.
And in Rust, you wouldn't create those memory bugs you're worried about. (Well, you can, but you have to go out of your way to take the safety off :)) That's kind of Rust's whole "shtick"
- koheripbal 6y agoYou can absolutely create memory leaks in Rust [1]. That's a bigger problem for server applications than CPU / Memory performance issues, because the latter can be traced more easily. As a (mediocre) dev and head of a team (some are great, and some are as bad as me), I'm far more worried about bugs than performance. [1] https://stackoverflow.com/questions/55553048/is-it-possible-to-cause-a-memory-leak-in-rust https://stackoverflow.com/questions/55553048/is-it-possible-...
- ragnese 6y agoDepends what we're talking about. A "true" memory leak (as in allocated memory that is not referenced) is not very likely. A reference cycle with `Arc`s can happen though. But if you're talking about Java and mediocre devs (I'm in the club- don't worry), I feel like there are no shortage of ways to make bugs with null, concurrency issues, etc, that Rust completely eliminates. You can make reference cycles in Rust, though. Also, in Rust code you often don't have references to references to references the way you do in Java, so it's just not an issue that I'm aware of having had yet.
- koheripbal 6y agohttps://stackoverflow.com/questions/55553048/is-it-possible-to-cause-a-memory-leak-in-rust https://stackoverflow.com/questions/55553048/is-it-possible-...
- estebank 6y agoThat SO answer restates what the parent said: you can leak data either explicitly (Box::leak/std::mem::forget) or by creating reference cycles when using Arc/Rc.