什么是Address Sanitizer?

AddressSanitizer is a fast memory error detector. It consists of a compiler instrumentation module and a run-time library. The tool can detect the following types of bugs:

Out-of-bounds accesses to heap, stack and globals
Use-after-free
Use-after-return (to some extent)
Double-free, invalid free
Memory leaks (experimental)

总结来说:**用来解决内存问题的**。
当发生Crash时,打印这个Crash内存的使用记录。通过这个使用记录来调试Bug。

Xcode中如何使用到?

  1. 你需要安装了xcode7
  2. 在xcode7中打开设置。
    Xcode 7 调试野指针利器 Address sanitizer
  3. 发生Crash后,拷贝内存地址
    Xcode 7 调试野指针利器 Address sanitizer
  4. 选中内存查看选项:View Memory
    Xcode 7 调试野指针利器 Address sanitizer
  5. 输入刚才的内存地址
    Xcode 7 调试野指针利器 Address sanitizer
  6. 点开右边的列表,就能看到内存调用记录了。
    Xcode 7 调试野指针利器 Address sanitizer
  7. 根据记录解决问题去吧。

相关文章:

  • 2022-12-23
  • 2022-01-03
  • 2021-09-10
  • 2022-12-23
  • 2021-06-30
  • 2021-10-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案