Re: NSXML & Auto Release Pools
Re: NSXML & Auto Release Pools
- Subject: Re: NSXML & Auto Release Pools
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 4 Feb 2009 11:25:33 -0700
On Feb 4, 2009, at 11:06 AM, Alan Shouls wrote:
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.
Does anyone have any insight into why this is happening and what
might be
going on here?
You must be using the NSXML* class in its own thread. If you're using
NSThread to detach a thread, and you are not using GC, then your
threaded method is responsible for setting up its own autorelease
pool, and keeping it active at all times. What's going on is releasing
the object is apparently autoreleasing some other internal object, but
since there's no pool in place, then the object gets leaked.
So you have to either wrap the entire method in its own pool, or use
GC, or use the +[NSApplication
detachDrawingThread:toTarget:withObject:] method, which is just like
the similar NSThread method, but it makes the pool for you.
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