• 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: "Carmen Cerino Jr." <email@hidden>
  • Date: Wed, 19 Nov 2008 18:32:09 -0500

I guess I should also have included what spawned this question in the
first place. I have read in a handful of places that you can
guarantee, in the example case, that blah will exist until the end of
function, and that sometime after the end of the scope of the function
blah will be released. So if you don't know when it will be released,
is there a possibility of it being released before control gets back
to the caller so it can retain it?

On Wed, Nov 19, 2008 at 6:19 PM, Kyle Sluder
<email@hidden> wrote:
> 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
>
> If you are just starting out, don't look for any patterns, just follow
> the rules.
>
> If you take ownership of an object, and want to return it and have
> nothing more to do with it, you need to relinquish ownership.  But if
> you just send it -release then it might go away before the caller gets
> it back, which is why -autorelease exists.
>
> --Kyle Sluder
>



--
Carmen C. Cerino
   University of Akron ACM Chapter President
   University of Akron Aux. Services Student Assistant
   Cell: 440.263.5057
   AIM: UAcodeweaver
   [ I <3 MACs ]
_______________________________________________

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

  • Follow-Ups:
    • Re: Autorelease Question
      • From: "Kyle Sluder" <email@hidden>
References: 
 >Autorelease Question (From: "Carmen Cerino Jr." <email@hidden>)
 >Re: Autorelease Question (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: Autorelease Question
  • Next by Date: Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)
  • Previous by thread: Re: Autorelease Question
  • Next by thread: Re: Autorelease Question
  • Index(es):
    • Date
    • Thread