• 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: NSXML & Auto Release Pools
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXML & Auto Release Pools


  • Subject: Re: NSXML & Auto Release Pools
  • From: James Montgomerie <email@hidden>
  • Date: Wed, 4 Feb 2009 18:38:37 +0000

On 4 Feb 2009, at 18:06, Alan Shouls wrote:
I am using NSXML in a C++ and am working through some test cases and have
come across something I can't quite figure out. Here is what I do:


1. Create an Auto Release Pool
2. Create an NSXML object using [NSXMLDocument alloc] initWithData: (NSData
*)data options:NSXMLNodeOptionsNone error:pError]
3. Release the Auto Release Pool
4. Release my NSXML object


I then get a warning NSCFString autoreleased with no pool in place - just
leaking


If, however I do things so that I release my NSXML object before releaseing
the Auto Release Pool - no message.

The NSXML object is probably calling autorelease on something in its dealloc method (this is perfectly legal, and should generally be seen as implementation detail - you're just seeing a side effect of it here).


In general, you need to wrap your /entire/ Cocoa usage in an autorelease pool if you're using it in a non-Cocoa app (or a thread that doesn't otherwise have a pool pre-created for you), to account for just this sort of thing.

Jamie.
_______________________________________________

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: NSXML & Auto Release Pools
      • From: Alan Shouls <email@hidden>
References: 
 >NSXML & Auto Release Pools (From: Alan Shouls <email@hidden>)

  • Prev by Date: Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string
  • Next by Date: Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string
  • Previous by thread: Re: NSXML & Auto Release Pools
  • Next by thread: Re: NSXML & Auto Release Pools
  • Index(es):
    • Date
    • Thread