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 (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 arch...@mail-archive.com

Reply via email to