How are Rust's Arc and Rc types different from having garbage collection?

后端 未结 4 1839
孤独总比滥情好
孤独总比滥情好 2021-01-12 19:09

The Rust Programming Language, first edition says that Rust does not have a garbage collector:

It maintains these goals without having a garbage colle

4条回答
  •  长发绾君心
    2021-01-12 19:22

    If you insist on being correct, a garbage collector collects. It collects a list of memory locations to free. Rc/Arc on the other hand does not, so I don't think you can call it garbage collection.

    However rust has the std::gc module, so yea rust has in fact an optional garbage collector for now.

提交回复
热议问题