• 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: Autoreleased Data In Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autoreleased Data In Cocoa


  • Subject: Re: Autoreleased Data In Cocoa
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 31 May 2011 09:44:59 -0600

On May 31, 2011, at 9:32 AM, Bing Li wrote:

> But I still have a question. If the autoreleased data will keep alive until the pool is drained, what if the data is autoreleased in a Cocoa auto-created pool? It will keep alive unless the process is shutdown?

No. The framework makes and drains pools as your application goes about its business. Just stick to the rules and don't worry about pools that are outside of your control.

> Thanks!
> Bing
>
> - (NSString *) receiveMessage
> {
>         NSMutableString *receivedString;

I would recommend initializing this to nil. Although it's highly unlikely, if a C++ or ObjC exception is thrown prior to receivedString being set, then your @finally method is going to crash sending an autorelease message to an uninitialized pointer.

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

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: 
 >Autoreleased Data In Cocoa (From: Bing Li <email@hidden>)
 >Re: Autoreleased Data In Cocoa (From: Nick Zitzmann <email@hidden>)
 >Re: Autoreleased Data In Cocoa (From: Bing Li <email@hidden>)

  • Prev by Date: Re: Autoreleased Data In Cocoa
  • Next by Date: Re: Autoreleased Data In Cocoa
  • Previous by thread: Re: Autoreleased Data In Cocoa
  • Next by thread: Re: Autoreleased Data In Cocoa
  • Index(es):
    • Date
    • Thread