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
到此断点设置完成,当某个地方因为内存原因断点便会停在那个地方。