What is the difference between releasing and autoreleasing?

后端 未结 4 1068
北海茫月
北海茫月 2020-12-08 12:10

I still have some unclear understand about release and autorelease. What are the difference between both of them? I have this code. For facebook connection. I crash it somet

4条回答
  •  既然无缘
    2020-12-08 12:42

    According to the Memory Management Programming Guide for Cocoa:

    The autorelease method, defined by NSObject, marks the receiver for later release. By autoreleasing an object—that is, by sending it an autorelease message—you declare that you don't want to own the object beyond the scope in which you sent autorelease.

    Also:

    The autorelease method thus allows every object to use other objects without worrying about disposing of them.

提交回复
热议问题