3 ms·
If find it much easier than malloc/free. Cocoa uses autorelease pool for short-lived objects, so most of the time you don't have to free them. For long-lived
by pornel 16y ago
If find it much easier than malloc/free.
Cocoa uses autorelease pool for short-lived objects, so most of the time you don't have to free them.
For long-lived objects you can use synthesized properties which handle retain/release for you.
In other cases you "guard" your use of object with retain/release. You can use these in pairs in the same place, rather than having malloc() in one part of the program, and free() in another.
You can freely pass reference to an object without worrying that you might free it while it's still referenced somewhere else. You don't have to think about ownership of an object.