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