我最近开始使用XCode AddressSanitizer,我认为它是XCode 7中引入的(例如参见Apple WWDC presentation),以帮助解决难以发现的奇怪错误。消毒剂实际上发现了一个问题,但是我很难解释它的含义。
您是否知道AddressSanitizer可以报告的错误类型的概述以及它们的解释?
在我的特定情况下,该错误在iOS库内部深处报告,最终源自我的代码:
[CATransaction commit];
报告的错误是:
==820==ERROR: AddressSanitizer failed to allocate 0x4b8000 (4947968) bytes of LargeMmapAllocator (error code: 12)
==820==Process memory map follows:
0x0193820000-0x019383d000 /System/Library/CoreServices/Encodings/libJapaneseConverter.dylib
0x019fb17000-0x019fb17020 /System/Library/CoreServices/Encodings/libJapaneseConverter.dylib
... very long list of mapped memory ...
==820==End of process memory map.
==820==AddressSanitizer CHECK failed: /Library/Caches/com.apple.xbs/Sources/clang/clang-703.0.29/src/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.cc:181 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
ERROR: Failed to mmap
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
(lldb) thread info -s
thread #1: tid = 0x993ca, 0x0000000100994010 libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie(), queue = 'com.apple.main-thread'
有人知道这个特定的错误是什么意思吗?
最佳答案
AddressSanitizer使用自定义内存分配器,在这种特殊情况下,内存不足。这不一定表示ASan本身或您的程序存在问题。
关于ios - XCode AddressSanitizer结果的解释,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36606353/