Re: NSXMLParser in background thread crashing
Re: NSXMLParser in background thread crashing
- Subject: Re: NSXMLParser in background thread crashing
- From: "Philip Q" <email@hidden>
- Date: Sat, 24 Feb 2007 02:03:48 +1300
On 24/02/07, Justin R. Miller <email@hidden> wrote:
On Feb 23, 2007, at 12:16 AM, Philip Q wrote:
> This isn't what thread safety means -- a thread safe class can be used
> from multiple threads without using locks. Large parts of
> Foundation/AppKit aren't thread safe, but are safe for using within a
> single thread.
Ok, this is good to know. Do you know where I can find more info
about this, specifically about defining the boundaries of these
'large parts'? :-)
<http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/articles/CocoaSafety.html>
> There shouldn't be any problem with using an NSXMLParser in a separate
> thread. What is a bit suspicious, is the NSAutoreleaePool being added
> to -parse. Why is it being added?
When I originally ran -parse in a background thread, I got complaints
of not having an autorelease pool and that memory was just leaking.
Although an autorelease pool is created automatically for your main
thread, you have to create them manually for any child threads.
See:
<http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/articles/CocoaDetaching.html#//apple_ref/doc/uid/20000738-97249>
for a description of the normal way this happens. You shouldn't
subclass to do this.
-Phil
_______________________________________________
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:
This email sent to email@hidden