What is the difference between Objective-C automatic reference counting and garbage collection?

后端 未结 4 599
[愿得一人]
[愿得一人] 2020-11-27 11:44

With the new automatic reference counting (ARC) introduced in Xcode 4.2, we no longer need to manually manage retain / release in Objective-C.

This seems similar to

4条回答
  •  心在旅途
    2020-11-27 12:09

    How does ARC differ from garbage collection?

    ARC is a form of garbage collection.

    You probably mean "what is the difference between ARC and tracing garbage collection (like the JVM and .NET)?". The main differences are that ARC is slower and leaks cycles. That's why the JVM and .NET both use tracing garbage collectors. For more information, please read How do reference counting and tracing garbage collection compare?.

提交回复
热议问题