Re: question about retain/release
Re: question about retain/release
- Subject: Re: question about retain/release
- From: Ed Watkeys <email@hidden>
- Date: Mon, 22 Dec 2003 14:27:47 -0500
On Dec 22, 2003, at 12:46 PM, Thierry Bucco wrote:
Hi evereybody,
I have a little question.
[...]
In several documentation I have read that I have to release every
object I allocate, copy or retain.
So, why newTitle isn't released on this example ?
Because you (should) release it in your dealloc method. If you keep a
reference to an object, you should retain it; otherwise it may get
released out from under you. Fully understanding retain counts and
auto-release pools is extremely important to writing software that
doesn't crash or leak memory. Others may have preferred books or web
sites for explaining how this works, but I found the discussion in
COCOA PROGRAMMING FOR MAC OS X by Hillegass enlightening:
http://www.amazon.com/exec/obidos/tg/detail/-/0201726831
Obsolescence warning: the second edition will be released in April.
Perhaps someone else can link to an equally clear on-line resource.
Regards,
Ed
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.