• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Autorelease Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Autorelease Question (From: "Carmen Cerino Jr." <email@hidden>)
 >Re: Autorelease Question (From: DKJ <email@hidden>)

  • Prev by Date: Re: Outlets / IBOutlet declarations (was Re: InterfaceBuilder &Wiring Objects)
  • Next by Date: Re: Autorelease Question
  • Previous by thread: Re: Autorelease Question
  • Next by thread: Re: Autorelease Question
  • Index(es):
    • Date
    • Thread