Does iOS 5 have garbage collection?

后端 未结 3 1662
故里飘歌
故里飘歌 2020-12-14 08:15

Do I no longer have to worry about memory management iOS 5 onwards? Also, will all programs written for iOS 4 and earlier versions have to be rewritten to allow iOS to manag

3条回答
  •  臣服心动
    2020-12-14 08:59

    Automatic Reference Counting implements automatic memory management for Objective-C objects and blocks, freeing the programmer from the need explicitly insert retains and releases.

    You will worry less about memory management. There is public info available on the subject:

    • ARC replacing GC? (lists.apple.com)
    • Automatic Reference Counting (clang.llvm.org). This is the tech spec on ARC.

    If the spec is too harsh to read, in short, you will need to edit the retain/release code to use ARC, but old programs remain compatible. What you shouldn't do is mix both.

提交回复
热议问题