Excellent summary of retain/release/autorelease

Posted by admin on Dec 22, 2008 in iPod / iPhone, Mac OS X |

From this page on wikipedia:

In practice, retain, release and autorelease are straightforward. Some people seem to find it confusing but perhaps they think it’s more complicated than it is. To keep an object you’re given, retain it. Objects you make are already retained. To throw it away and refer to it no more, release it. If you write a factory method, autorelease it. If you are simply making use of an object returned by a factory method for a short while, do nothing.

Comments are closed.

Copyright © 2017 Standalone Code LLC All rights reserved. Theme by Laptop Geek.