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 (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