Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

‘static is a compile time thing for ensuring memory safety. It doesn’t really have anything to say about when the object will be collected. In fact, since Rust/C/C++ applications use precise garbage collection techniques, they’re going to track the lifetime strictly more accurately than a garbage collected language (which I’m presuming you mean tracing GC). Of course you could have a memory leak / reference cycles but memory leaks are possible with tracing GCs as well (just different kinds of leaks but they are a strict subset of the situations that would cause a leak for things like reference counting iirc).

What lifetimes do let you accomplish is more fearless ownership tracking and letting the compiler expire references for you without needing to use any kind of reference counting. And all things being equal, precise garbage tracking results in lower peak and average memory usage.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: