Don't think about it.

If memory management confuses you in any way, don't try to think about
the status of objects returned from framework methods. Only worry
about it from the perspective of your code. Do you need the object to
stay around after your method returns? Then retain it, and remember to
release it somewhere else as appropriate. If you make an object with
+alloc or -copy, then you'll need to release it somewhere too.

In practice, most framework methods return autoreleased objects (if
the method creates it). There are other situations, for example:
-[NSArray objectAtIndex:] will return an object that is retained by
the array, and is not in any autorelease pools (unless you've put it
in one). But that's because the object was not created by the array.

Bottom line: don't think about it. Follow the rules in your own code,
and all will be well.

Owen
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to