帮助解释堆栈跟踪

时间:2011-09-15 16:19:48

标签: objective-c ios cocoa-touch ios4

Thread 12 Crashed:
0   libsystem_kernel.dylib          0x3076da1c __pthread_kill + 8
1   libsystem_c.dylib               0x35c8a3b4 pthread_kill + 52
2   libsystem_c.dylib               0x35c82bf8 abort + 72
3   libstdc++.6.dylib               0x33f61a64 __gnu_cxx::__verbose_terminate_handler() + 376
4   libobjc.A.dylib                 0x360f506c _objc_terminate + 104
5   libstdc++.6.dylib               0x33f5fe36 __cxxabiv1::__terminate(void (*)()) + 46
6   libstdc++.6.dylib               0x33f5fe8a std::terminate() + 10
7   libstdc++.6.dylib               0x33f5ff5a __cxa_throw + 78
8   libobjc.A.dylib                 0x360f3c84 objc_exception_throw + 64
9   Foundation                      0x31af8dea _NSOutOfMemoryErrorHandler + 38
10  CoreFoundation                  0x31e91496 __CFStringHandleOutOfMemory + 22
11  CoreFoundation                  0x31e951ea __CFStringChangeSizeMultiple + 506
12  CoreFoundation                  0x31e982c0 __CFStringCheckAndReplace + 148
13  Foundation                      0x31a81228 -[NSCFString appendString:] + 28
14  MyApp                           0x00016a86 -[XMLParser parser:foundCharacters:] (XMLParser.m:109)

在设备上与SIGABRT发生冲突。

XMLParser代码段:

- (void)parser:(XMLParser *)parser foundCharacters:(NSString *)string
{
    if(!currentString)
    {
        currentString = [[NSMutableString alloc] init];
    }
        [currentString appendString:string]; // Line 109 that crashed   
}

为什么它附加nil字符串会崩溃?或访问受保护的内存

1 个答案:

答案 0 :(得分:2)

_NSOutOfMemoryErrorHandler使得相当清楚 - 你的内存不足。使用仪器和内存泄漏等检查设备对内存密集程度过高的部件。