I have recently started using the XCode AddressSanitizer, which I think was introduced in XCode 7 (see e.g. Apple WWDC presentation), to help with a difficult to find strange error. The Sanitizer actually found a problem, but I have a hard time interpreting what it means.
Do you know of an overview of the type of errors that AddressSanitizer can report and an explanation of them?
In my specific case, the error is reported deep inside iOS libraries, eventually originating from my code:
The reported error is:
==820==ERROR: AddressSanitizer failed to allocate 0x4b8000 (4947968) bytes of LargeMmapAllocator (error code: 12)
==820==Process memory map follows:
... 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'
Does anybody know what this specific error means?
AddressSanitizer uses a custom memory allocator, and it runs out of memory in this particular case. This does not necessarily denote a problem in ASan itself or your program.