3 ms·
The article I linked deals with this. GCs typically guarantee cleanup in a scope. With managed languages, this is whenever the runtime decides to run the GC (pr
by zamalek 8y ago
The article I linked deals with this. GCs typically guarantee cleanup in a scope. With managed languages, this is whenever the runtime decides to run the GC (probably when memory is needed and isn't available). With Rust RAII this is when the ref count reaches zero which is, at the very soonest, at the end of the current scope (you can force the collection with a naked scope if you need[1]).
[1]: https://play.rust-lang.org/?gist=66740557884b17683b868483e524c6ba&version=stable&mode=debug&edition=2015 https://play.rust-lang.org/?gist=66740557884b17683b868483e52...