3 ms·
no it doesn't
by dankobgd 2y ago
no it doesn't
- rc00 2y agoIt absolute does. What do you think Arc/Rc are?
- nottorp 2y agoBy the name i'd say Arc is reference counting, which isn't exactly garbage collection...
- rc00 2y agoReference counting is quite literally a subset of garbage collection.
- nottorp 2y agoThen malloc/free are quite literally a subset of the borrow checker :)
- pod_krad 2y agoGarbage Collector acts mainly in unpredictable way. I mean it is possible it won't free memory even if counter is zero already. This is not true if we are talking about Rust.
- rc00 1y agohttps://news.ycombinator.com/item?id=43614013 https://news.ycombinator.com/item?id=43614013
- SpaceNugget 2y ago(Atomic) Reference Counted structs. They count their own references, there is no external mechanism tracking all of the reference counts at runtime. Modern rust does not include a garbage collector. You might be confusing a garbage collector with the general concept of memory management, which is a feature of (AFAIK) every high level language. Many C projects also have reference counted structs, but a reference count and a call to malloc/free doesn't quite qualify as garbage collection to most developers.
- rc00 2y agoYou might be confusing "garbage collector" and "garbage collection" and Rust definitely has the latter. Reference counting is also a subset of garbage collection. That is a matter of fact, not opinion. See below. https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Reference_counting https://en.wikipedia.org/wiki/Garbage_collection_(computer_s...
- SpaceNugget 1y agoI might be wrong, but I think you took offence to me suggesting you might be confused. If so, I'm sorry. I didn't mean it in a negative way, I was trying to soften my language but I phrased it badly. Regardless, my point was that Rust _the language_ does not provide garbage collection. The Arc/Rc structs are where the reference counting is implemented. You can create reference counted objects in C, like GObjects in GLib. However, I think you would agree with most people that C does not have garbage collection. Otherwise the concept of a language having or not having garbage collection is diluted to the point of meaninglessness. At that point I think memory management is a more apt term.
- rc00 1y ago> Regardless, my point was that Rust _the language_ does not provide garbage collection. These are language features not dependencies or external libraries. Maybe the best phrasing is that Rust's garbage collection features are opt-in, similar to the same features being opt-out for Go, Nim, OCaml, and others. GLib is an external library to C and C's standard library. Arc/Rc (and there are other types of garbage collection within Rust _the language_) are language features since they are built-in types. The delineation is very clear here. If it is part of the language's standard features and/or standard library then it is part of the language. Using opt-in/opt-out terminology also make clear how the garbage collection features are available. In Rust, you opt into garbage collection by using specific built-in types.