Reputation: 479
As LLVM compiler with ARC option add retain, copy,release and autorelease for us automatically, but how does ARC determine whether to use retain or copy? Thanks in advance:)
Upvotes: 2
Views: 316
Reputation: 11839
As mentioned in following docs (http://clang.llvm.org/docs/AutomaticReferenceCounting.html#meta)
Automatic Reference Counting implements automatic memory management for Objective-C objects and blocks, freeing the programmer from the need to explicitly insert retains and releases. It does not provide a cycle collector; users must explicitly manage the lifetime of their objects, breaking cycles manually or with weak or unsafe references.
Also you can go through the discussion of this thread - How does the new automatic reference counting mechanism work?
Upvotes: 0
Reputation:
ARC doesn't add copy
, that's still your responsibility if you need copies. It only manages retain
and release
for you. If you manually copy
something though it knows that you get a new object that it will have to release at some time.
Upvotes: 4