地址消毒剂已添加的新功能在Xcode 7
使用Runtime Sanitization
>Enable Address Sanitizer
标志在你的计划,启用该选项。然后
git会显示此更改您的.xcscheme
文件:
enableAddressSanitizer = "YES"
从New Features in Xcode 7文件:
Address Sanitizer. Xcode 7 can build your app with instrumentation designed to catch and debug memory corruption using the address sanitizer.
Objective-C and C code is susceptible to memory corruption issues such as stack and heap buffer overruns and use-after-free issues. When these memory violations occur, your app can crash unpredictably or display odd behavior. Memory corruption issues are difficult to track down because the crashes and odd behavior are often hard to reproduce and the cause can be far from the origin of the problem.
You enable the address sanitizer in the build scheme. Once enabled, added instrumentation is built into the app to catch memory violations immediately, enabling you to inspect the problem right at the place where it occurs. Other diagnostic information is provided as well, such as the relationship between the faulty address and a valid object on the heap and allocation/deallocation information, which helps you pinpoint and fix the problem quickly.
Address sanitizer is efficient—fast enough to be used regularly, as well as with interactive applications. It is supported on OS X, in the Simulator, and on iOS devices.
我得到了一个错误太:'铛:错误:不支持的选项'-faddress-sanitizer'。然而,在'clang --help'中,我可以看到这个选项 – Guillaume 2013-04-21 11:17:55
@gaige:问题在于苹果正在部署**旧的**版本的Clang,它仍然使用旧的“-faddress-sanitizer”。稍后加入新的'-fsanitize = address',当添加其他杀菌剂时。 – 0xC0000022L 2014-02-25 14:43:09
@ 0xC0000022L对不起,当我说“你需要从一个更新的源代码构建clang”时,我认为我在上面提到了这点。无可否认,它并没有明确表示苹果的版本较旧,但它确实建议从较新版本开始构建。我会更新语言以使其更清楚。 – gaige 2014-02-25 20:20:46