我最近开始使用 XCode AddressSanitizer,我认为它是在 XCode 7 中引入的(参见例如 Apple WWDC presentation ),以帮助解决难以发现的奇怪错误。 sanitizer 实际上发现了一个问题,但我很难解释它的含义。
您是否了解 AddressSanitizer 可以报告的错误类型及其解释的概述?
在我的具体案例中,错误是在 iOS 库的深处报告的,最终源 self 的代码:
[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/