How to find the cause of a malloc “double free” error?

后端 未结 13 991
情深已故
情深已故 2020-11-27 09:51

I\'m programming an application in Objective-C and I\'m getting this error:

MyApp(2121,0xb0185000) malloc: *** error for object 0x1068310: double

13条回答
  •  孤街浪徒
    2020-11-27 10:47

    You'll find out what the object is when you break in the debugger. Just look up the call stack and you will find where you free it. That will tell you which object it is.

    The easiest way to set the breakpoint is to:

    1. Go to Run -> Show -> Breakpoints (ALT-Command-B)
    2. Scroll to the bottom of the list and add the symbol malloc_error_break

提交回复
热议问题