我最近开始使用 XCode AddressSanitizer,我认为它是在 XCode 7 中引入的(参见例如Apple WWDC 演示文稿),以帮助解决难以发现的奇怪错误。Sanitizer 实际上发现了一个问题,但我很难解释它的含义。
您是否了解 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'
有人知道这个特定错误是什么意思吗?