Re: Autorelease Question
Re: Autorelease Question
- Subject: Re: Autorelease Question
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 19 Nov 2008 16:29:31 -0800
On Nov 19, 2008, at 3:07 PM, DKJ wrote:
In general, if you retain an object, or use a either a "copy" or an
"init..." method to obtain it, you need to release it yourself when
you're done with it.
Otherwise, you can assume that the object will dispose of itself at
some future time. But when this will happen is in practice
unpredictable, which is why you need to retain the object before
doing anything else with it.
This is at best misleading.
*Please*, don't try to reformulate the memory management rules when
answering a question.
The more time goes by, the more I am convinced that most developers'
confusion about memory management arises from other developers'
misleading or incorrect answers to questions such as this.
Simply point to the canonical reference material (Kyle's answer
provides a great model):
Read this document:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html#//apple_ref/doc/uid/20000043-BEHDEDDB
Then read this one:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html
[...]
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