Objective-C autorelease memory management

前端 未结 4 671
粉色の甜心
粉色の甜心 2021-02-07 11:51

Im trying to understand when to call autorelease, and what this will actually do to my object.

After reading About Memory Management in the Mac Developer Library I under

4条回答
  •  梦如初夏
    2021-02-07 12:40

    How can i safely use the returned autoreleased object inside my runIt method if i dont know when the autorelease trigger?

    Autorelease will trigger after the current run loop ends.

    Should i retain the object returned by the createNewTest ? or can i safely use it within the runIt scope?

    You can safely use it inside the runIt scope.

提交回复
热议问题