0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I turned that on and it says it writes it to the /tmp/ folder. How do I use "malloc_history"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.