ios - XCode AddressSanitizer 结果解读

标签 ios xcode address-sanitizer

我最近开始使用 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/

相关文章:

ios - iOS 应用程序的视频启动画面

ios - uisplitviewcontroller 转至另一个 uisplitviewcontroller

ios - INIntent `setImage` 使运行时在 Swift 5 中崩溃

ios - Xcode 5 中缺少 ViewController.xib

ios - 无法在 xcode 5 中更改应用程序的名称

ios - 我可以在自身内部编写应用程序 - Xcode/iOS 吗?

ios - 回到第一个 View Controller 时无法停止音乐

c++ - UBSan 和 Asan 在 GCC 4.9.2 中的使用

c++ - 如何在 Android NDK GCC 上使用 AddressSanitizer?

ubuntu - 为什么 ASAN_SYMBOLIZER_PATH 不再适用于版本修饰的二进制文件