Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: malloc_error_break



Thanks for the links, Bryan.

I've worked in a lot of different PC IDEs and most would break at the line of source code that caused the problem when you are running your app in debug mode. Xcode seems so archaic to me.

On Apr 7, 2008, at 1:09 PM, Bryan Henry wrote:
You're in good company timeframe wise, at least with myself.

You can set a breakpoint at 'malloc_error_break' by typing 'break malloc_error_break' in the Xcode console when you're at a (gdb) prompt. After that, you can trace the stack backwards to try and find where your problem originates from. Just from the error, though, it sounds like you're over-releasing an object. Finding what object you're over-releasing is the first step to fixing the bug. Something like malloc_history may help with finding where the specific object originated from:

I recommend taking a look at the following things to brush up on some common debugging techniques:

Also, I've found NSZombieEnabled to be an invaluable tool for diagnosing memory allocation problems, so you may want to take a look here too:

Bryan
(Eventually I'm going to get this down and actually hit Reply All)

On Apr 7, 2008, at 12:43 PM, Don Arnel wrote:
Hi all,

This is my first time posting to the list.

I've been working on a project using Xcode for the past month now. This is my first time programming in Xcode, but I'm a long-time C++ programmer so objective-c was pretty easy to get a handle on. The only hair-pulling problem I have is with all the 'retain' and 'release' mumbo jumbo.

I'm getting this message in the console while testing my app:

NewApp(2464,0xa0684fa0) malloc: *** error for object 0x1d7f80: double free
*** set a breakpoint in malloc_error_break to debug

I've tried to look for 'malloc_error_break' in the documentation (which I must say is very poor and difficult to use) but came up empty. So, how does one go about setting a breakpoint in malloc_error_break?

Thanks for any help!
- Don
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >malloc_error_break (From: Don Arnel <email@hidden>)
 >Re: malloc_error_break (From: Bryan Henry <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.