How to "set a breakpoint in malloc_error_break to debug"

IphoneIos

Iphone Problem Overview


I'm getting lots of console outputs like this without my application crashing:

> malloc: *** error for object 0xc6a3970: pointer being freed was not > allocated *** set a breakpoint in malloc_error_break to debug

How can I find out which object or variable is affected?

I tried setting a symbolic breakpoint like this but it never halts:

enter image description here

Iphone Solutions


Solution 1 - Iphone

Set a breakpoint on malloc_error_break() by opening the Breakpoint Navigator (View->Navigators->Show Breakpoint Navigator or ⌘8), clicking the plus button in the lower left corner, and selecting "Add Symbolic Breakpoint". In the popup that comes up, enter malloc_error_break in the Symbol field, then click Done.

EDIT: openfrog added a screenshot and indicated that he's already tried these steps without success after I posted my answer. With that edit, I'm not sure what to say. I haven't seen that fail to work myself, and indeed I always keep a breakpoint on malloc_error_break set.

Solution 2 - Iphone

In your screenshot, you didn't specify any module: try setting "libsystem_c.dylib"

enter image description here

I did that, and it works : breakpoint stops here (although the stacktrace often rise from some obscure system lib...)

Solution 3 - Iphone

I had the same problem with Xcode. I followed steps you gave and it didn't work. I became crazy because in every forum I saw, all clues for this problem are the one you gave. I finally saw I put a space after the malloc_error_break, I suppressed it and now it works. A dumb problem but if the solution doesn't work, be sure you haven't put any space before and after the malloc_error_break.

Hope this message will help..

Solution 4 - Iphone

I had given permissions I shouldn't have to write in some folders (especially /usr/bin/), and that caused the problem. I fixed it by opening Disk Utility and running 'Repair Disk Permissions' on the Macintosh HD disk.

Solution 5 - Iphone

I solve it by close safari inspector. Refer to my post. I also found sound sometimes when I run my app for testing, then I open safari with auto inspector on, after this, I do some action in my app then this issue triggered.

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionopenfrogView Question on Stackoverflow
Solution 1 - IphoneAndrew MadsenView Answer on Stackoverflow
Solution 2 - IphoneVinzzzView Answer on Stackoverflow
Solution 3 - IphoneSébastienView Answer on Stackoverflow
Solution 4 - Iphoneuser3843991View Answer on Stackoverflow
Solution 5 - IphoneLF00View Answer on Stackoverflow