Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.




On 19/12/2006, at 12:42 PM, John Stiles wrote:

Unless your app is doing very clever things, there isn't any justification for allocating an autorelease pool without releasing it.
These are particularly tricky because they are implemented in a stack, and if you do not keep the stack properly balanced, it is quite easy to make crash-inducing mistakes.

Just to add to that, you should be careful about *not* releasing autorelease pools when exceptions are involved.


- (void)myMethod
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  @try {
    // do something


} @catch (NSException *e) { // Don't be tempted to stick a [pool release] in here

    @throw;
  } @finally {
   // or here

  }

  [pool release];
}

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden

References: 
 >RE: Cocoa called from Carbon, objc_msgSend crash in 10.3.9. (From: "Matt Fox-Wilson" <email@hidden>)
 >Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9. (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.