memory-management

2011-08-15T04:15:02.000Z
Tags: objective-c programming iOS

Whenever you call a method on a class or an object, if that method does not contain alloc, new, or copy you can assume whatever object you are getting back to be an autorelease object.  And if you want to do stuff with that object and fear that the object provided will be released, you should retain it. Then as soon as you are done using that object you should release it.  There are some assumptions which we must follow for all this to work.  Its kind of interesting.

If I am passed an object into one of my methods I need to assume that the object was an autorelease object and so I should retain it.

Last Updated: 5/21/2019, 12:58:44 PM