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 (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