Hi Jens,

NSDateFormatter is listed as thread-unsafe in the documentation, so you need to 
review how you're using your instances.

<http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/10000057i-CH12-122647-BBCCEGFF>

If you have more specific questions to do with what's OK or not, I'd suggest 
filing a bug report to ask for improved documentation.

j o a r


On 31 okt 2011, at 17:27, Jens Alfke wrote:

> I have some code that uses a shared NSDateFormatter instance to convert dates 
> to/from ISO-8601 format. This code is now being invoked on multiple threads, 
> and I’m getting intermittent malloc warnings about double frees, and one 
> actual crash.
> My assumption was that an NSDateFormatter should be thread-safe as long as I 
> treat it as read-only (not changing any attributes) but this makes me think 
> I’m wrong. Anyone know for sure?
> 
> Here’s the usual backtrace I see in a malloc warning or crash:
> 
> #0  0x018f83b4 in icu::OlsonTimeZone::operator= ()
> #1  0x018f9f2d in icu::OlsonTimeZone::clone ()
> #2  0x018bb400 in icu::DateFormat::parse ()
> #3  0x01964d05 in udat_parse ()
> #4  0x01623161 in CFDateFormatterGetAbsoluteTimeFromString ()
> #5  0x01622f8e in CFDateFormatterCreateDateFromString ()
> #6  0x006bf7e9 in getObjectValue ()
> #7  0x006bf701 in -[NSDateFormatter 
> getObjectValue:forString:errorDescription:] ()
> #8  0x006bfa3f in -[NSDateFormatter dateFromString:] ()
> …
> 
> —Jens
> 
> _______________________________________________
> 
> 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/joar%40joar.com
> 
> This email sent to j...@joar.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