EXC_BAD_ACCES
malloc: *** mmap(size=4294955008) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
編譯報錯
方法一:
0.Xcode菜單
Product => Scheme => Edit Scheme =》Arguments => Environment Variables 中加
Name Value
NSZombieEnabled YES
MallocStackLoggingNoCompact YES
MallocStackLogging YES
1.Xcode菜單 Product => Scheme => Edit Scheme =》 Info => Debugger 裏面選擇 LLDB
2.在控制檯:
模擬器 po [$eax name] //name 爲要打印的參數 還有class等參數
真機 po [$r0 name]
方法二、malloc_error_break 加 Breakpoint 斷點
在斷點查看處(Breakpoint)左下角"+"號裏選 "Add Symbolic Breakpoint" 然後在彈出的框中輸入錯誤的類型如 "malloc_error_break" 點Done確定。
在已加的斷點上右鍵 Move Breakpoint To 裏面選擇 User 。
Xcode菜單 Product => Scheme => Edit Scheme =》 Info => Debugger 裏面選擇 GDB
到此斷點設置完成,當某個地方因爲內存原因斷點便會停在那個地方。