iPhone memory management, a newbie question

前端 未结 3 1553
夕颜
夕颜 2021-01-07 02:51

I\'ve seen in (Apple) sample code two types of ways of allocation memory, and am not sure I understand the difference and resulting behavior.

// FAILS
NSMuta         


        
3条回答
  •  猫巷女王i
    2021-01-07 03:09

    In the first instance you are getting an autoreleased object, which you don't need to release

    The second instance is where you are manually allocating the memory yourself, so you a responsible for releasing it.

    Read this documentation for help:-

    http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html

提交回复
热议问题