Instruments (Leaks) und NSDateFormatter
Wenn ich meine iPhone-App mit Instruments Leaks ausführe und eine Reihe von NSDates mit NSDateFormatter analysiere, steigt mein Speicher um 1 MB und bleibt bestehen, obwohl diese NSDates nach dem Parsen freigegeben werden sollten (ich verwerfe sie nur, wenn sie nicht neu sind).
Ich dachte, der Malloc (in meinem schwersten Stack-Trace unten) könnte Teil des NSDate werden, aber ich dachte auch, es könnte sich um Speicher handeln, der nur während eines Zwischenschritts beim Parsen verwendet wurde. Weiß jemand, welches es ist oder wie man herausfindet?
Gibt es auch eine Möglichkeit, einen Haltepunkt für die Freigabe von NSDate zu setzen, um festzustellen, ob dieser Speicher wirklich zurückgewonnen wird?
So sieht mein Datumsformatierer aus, um diese Daten zu analysieren:
df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"EEE, d MMM yyyy H:m:s z"];
Hier ist die Ablaufverfolgung für den schwersten Stapel, wenn der Speicher voll ist und dort verbleibt:
0 libSystem.B.dylib 208.80 Kb malloc
1 libicucore.A.dylib 868.19 Kb icu::ZoneMeta::getSingleCountry(icu::UnicodeString const&, icu::UnicodeString&)
2 libicucore.A.dylib 868.66 Kb icu::ZoneMeta::getSingleCountry(icu::UnicodeString const&, icu::UnicodeString&)
3 libicucore.A.dylib 868.67 Kb icu::ZoneMeta::getSingleCountry(icu::UnicodeString const&, icu::UnicodeString&)
4 libicucore.A.dylib 868.67 Kb icu::DateFormatSymbols::initZoneStringFormat()
5 libicucore.A.dylib 868.67 Kb icu::DateFormatSymbols::getZoneStringFormat() const
6 libicucore.A.dylib 868.67 Kb icu::SimpleDateFormat::subParse(icu::UnicodeString const&, int&, unsigned short, int, signed char, signed char, signed char*, icu::Calendar&) const
7 libicucore.A.dylib 868.67 Kb icu::SimpleDateFormat::parse(icu::UnicodeString const&, icu::Calendar&, icu::ParsePosition&) const
8 libicucore.A.dylib 868.67 Kb icu::DateFormat::parse(icu::UnicodeString const&, icu::ParsePosition&) const
9 libicucore.A.dylib 868.67 Kb udat_parse
10 CoreFoundation 868.67 Kb CFDateFormatterGetAbsoluteTimeFromString
11 CoreFoundation 868.67 Kb CFDateFormatterCreateDateFromString
12 Foundation 868.67 Kb -[NSDateFormatter getObjectValue:forString:range:error:]
13 Foundation 868.75 Kb -[NSDateFormatter getObjectValue:forString:errorDescription:]
14 Foundation 868.75 Kb -[NSDateFormatter dateFromString:]
Vielen Dank!