MrHappyAsthma
MrHappyAsthma

Reputation: 6522

Xcode malloc error debugging

I have a large amount of code and it throws the following error/exception.

malloc: *** error for object 0xce52964: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

If I run it with all the memory management stuff such as NSZombies and such enabled then it functions perfectly fine.

I added a Symbolic Exception Breakpointof type malloc_error_break, and it stops on a random line (an NSLog(@"part6"); in which I use to help debug my code by breaking it into sections via NSLog).

I've also tried typing into the debugger and this is what I get:

po 0xce52964
(int) $3 = 216344932 [no Objective-C description available]

Does anyone know how I can attempt to further debug this? I'm not sure what in my code is causing this issue.

Upvotes: 0

Views: 2621

Answers (1)

justin
justin

Reputation: 104698

Enable malloc stack logging (which can be done in Xcode - a few checkboxes below zombies).

Then Run/Test your program - Reproduce the issue. Now use the malloc_history util to get more info about the allocation which malloc has flagged in the message.

Upvotes: 1

Related Questions