问题描述
正如在WWDC 2015上宣布的那样,Clang Address Sanitizer正在引入Xcode和OS X。
As announced at WWDC 2015, Clang Address Sanitizer is being brought to Xcode and OS X.
如何为Xcode项目启用Clang Address Sanitizer
How do you enable Clang Address Sanitizer for your Xcode project?
推荐答案
Address Sanitizer已作为Xcode 7中的新功能添加。
Address Sanitizer has been added as a new feature in Xcode 7.
在方案中使用运行时清理
> 启用地址清理器
标志来启用该选项。
Use the Runtime Sanitization
> Enable Address Sanitizer
flag in your scheme to enable the option.
git会在您的 .xcscheme
文件中显示此更改:
git will then shown this change to your .xcscheme
file:
enableAddressSanitizer = "YES"
来自文档:
Objective-C和C代码易受内存损坏问题(例如堆栈)的影响以及堆缓冲区溢出和释放后使用问题。当发生这些内存冲突时,您的应用程序可能会意外崩溃或显示异常行为。内存损坏问题很难跟踪,因为崩溃和奇怪的行为通常很难重现,并且原因可能离问题的根源很远。
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.
地址清理器非常高效-足够快,可以定期使用,也可以用于交互式应用程序。它在OS X,模拟器和iOS设备上受支持。
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.
这篇关于如何在Xcode中启用Clang Address Sanitizer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!