Garbage collection vs. shared pointers

前端 未结 3 1971
栀梦
栀梦 2020-12-15 06:13

What are the differences between shared pointers (such as boost::shared_ptr or the new std::shared_ptr) and garbage collection methods (such as those implemented in Java or

3条回答
  •  余生分开走
    2020-12-15 06:16

    Those Shared Pointers (usually called reference counting) run the risk of cycles.

    Garbage collection (Mark and Sweep) does not have this problem.

提交回复
热议问题