Re: Methods that return autoreleased objects?
Re: Methods that return autoreleased objects?
- Subject: Re: Methods that return autoreleased objects?
- From: mmalc crawford <email@hidden>
- Date: Sun, 29 Jun 2008 08:13:49 -0700
On Jun 29, 2008, at 8:02 AM, Charles Srstka wrote:
Yes, but it's not obvious, which is why I thought to point it out
since we're discussing the times when you should and shouldn't
release objects. The alloc, init, and retain methods are also
documented, but that doesn't mean we can't help people out with
them, does it? I just think that the standard "release something
only if you inited or retained it" advice should be amended to
"release something only if you inited or retained it, or if you got
it from a NIB."
No, it shouldn't. Because exactly what you do with objects you get
from a nib depends on a number of factors. The memory management
guide itself has a complete article on the subject:
<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemMgmtNibObjects.html
>
which any Cocoa developer should have read as part of the fundamentals.
The basic memory management rules are simple and straightforward, and
should be preserved as such -- simple and straightforward as they are
they still seem to cause enough confusion.
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden