double free*** set a breakpoint in malloc_error_break to debug in ARC

南笙酒味 提交于 2019-12-17 21:05:34

问题


I am using ARC in my application with core data and threading etc, after doing all that hard work to get core data work with threading without any crashes now I am getting a new crash with the reason-

double free*** set a breakpoint in malloc_error_break to debug

How am I supposed to handle this? I have no control on the objects' retain counts.


回答1:


  1. Enable Zombie
  2. Follow this link : http://iphone2020.wordpress.com/2012/02/23/capturing-exceptions-while-debugging/. This will suggest exact point of crash.



回答2:


If you want to know who destroyed the allocation:

Simply breaking as the message suggests will give you clues.

If you want to know who created the allocation:

Although you can also do this from the command line using malloc stack logging, it may be a gentler introduction to use Instruments. Run the program with allocation recording enabled in instruments, reproduce the issue, then look up the address in instruments of the double free -- it will show you the backtrace of the allocation's creation. then figure why that allocation was freed twice.



来源:https://stackoverflow.com/questions/10587266/double-free-set-a-breakpoint-in-malloc-error-break-to-debug-in-arc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!