Re: The bug where terminal and xcode ran "different"
Re: The bug where terminal and xcode ran "different"
- Subject: Re: The bug where terminal and xcode ran "different"
- From: Rick Altherr <email@hidden>
- Date: Sat, 10 Feb 2007 13:37:34 -0800
On Feb 10, 2007, at 1:12 PM, Theodore H. Smith wrote:
I finally figured out the bug.
Xcode was using a different kind of malloc that would fill my data
with certain values that somehow allowed my code to work properly.
Running my app from the terminal used a different version of malloc
that used some garbage values.
Obviously, this is an error in my app. A classic memory management
error :( Shame, I really hate those things. But they are
unavoidable when you are writing high performance stuff, because in
these cases you can't rely on vectors or other easy stuff to "do
the right thing", speedwise.
Anyhow, I did solve this problem. The answer to my question was
that Xcode was linking to a different version of malloc.
No bug in Xcode, just a bug in my code that the terminal
(strangely) was better at uncovering.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
If you didn't zero out the memory you got from malloc(), then expect
it to always be some form of garbage. When you run under gdb, things
can happen in a slightly different order and cause different garbage
to be in place than when you run normally. Different optimization
levels can also cause slightly different behaviors since at higher
optimization levels, more things will be in registers rather than
memory and the garbage values will be different.
--
Rick Altherr
Architecture and Performance Group
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:
This email sent to email@hidden