Xcode 7 調試野指針利器 Address sanitizer
什么是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中如何使用到?
- 你需要安裝了xcode7
- 在xcode7中打開設置。
- 發生Crash后,拷貝內存地址
- 選中內存查看選項:View Memory
- 輸入剛才的內存地址
- 點開右邊的列表,就能看到內存調用記錄了。
- 根據記錄解決問題去吧。