3

Is anyone familiar with the problem. I have read this post however its hard for me to provide code when I don't have any idea where in the code the error originates. Any one have any ideas?

Name(9369,0xa09cd500) malloc: * error for object 0xb50dd20: double free * set a breakpoint in malloc_error_break to debug

Community
  • 1
  • 1
TheLearner
  • 19,387
  • 35
  • 95
  • 163

2 Answers2

4

Do as the debugger tells you: set a breakpoint on malloc_error_break.

Run → Manage Breakpoints → Add Symbolic Breakpoint.

Alex Cio
  • 6,014
  • 5
  • 44
  • 74
zoul
  • 102,279
  • 44
  • 260
  • 354
  • I come from a .NET background - I have done as you say but its asks for a name of the breakpoint? – TheLearner Nov 02 '10 at 10:14
  • That’s strange. Do you have breakpoints enabled? (Does a regular breakpoint anywhere in the code work?) You seem to have some manual `free` calls in your code. If they’re not too many, you can set a regular breakpoint or a logging statement on them and see which one of them is the culprit. – zoul Nov 02 '10 at 10:26
  • I managed to get it to break at malloc_error_break but it doesn't tell me anything. How do I setup a logging statement to see who is the culprit? – TheLearner Nov 02 '10 at 10:29
  • If you get a break on `malloc_error_break`, you should be able to navigate through the stack in the Xcode debugger to see the call that makes this happen. – zoul Nov 02 '10 at 11:00
  • I get what you saying but its just columns of letters and numbers - its not actually my code – TheLearner Nov 02 '10 at 11:31
  • I did not manage to debug but I found the problem by going through all my release and alloc methods – TheLearner Nov 02 '10 at 11:35
  • 1
    FYI you'll need to "go up" in the stack trace (left-hand column of debugger) until you get to a method call you recognize. That should tell you where the error is. glad you got it fixed. – Stephen Furlani Nov 02 '10 at 14:47
  • I have been terribly spoilt by .NET and Visual Studio - its a nightmare debugging in Xcode! – TheLearner Nov 03 '10 at 09:17
  • In Xcode 4.3.2, the breakpoints can be found in **View → Navigators → Show Breakpoints Navigator** or ⌘6 (Cmd-6) – Andreas Ley May 15 '12 at 09:46
1

You have release an object that you are not responsible...
there was many thread on this subject.

To summarized, you have to release (or autorelease) only object you have alloc, retain or copy

Benoît
  • 7,395
  • 2
  • 25
  • 30