Re: Debugging memory corruption? (C++)
Re: Debugging memory corruption? (C++)
- Subject: Re: Debugging memory corruption? (C++)
- From: Jens Alfke <email@hidden>
- Date: Fri, 30 Oct 2009 08:45:28 -0700
On Oct 30, 2009, at 8:24 AM, Jean-Denis Muys wrote:
My code is corrupting memory and I have a hard time finding the bug.
Perhaps somebody can point me to some tool or idea that has escaped
me so far.
I sympathise! These kinds of bugs can be brutal.
I probably can't use the XCode "Enable Guard Malloc" command either.
I tried, but after waiting for about an hour for the host app to
launch, I stopped. It was either crashed or so tremendously slowed
down that I couldn't do anything useful.
Guard Malloc can cause extreme slowdowns like that. If you can spare
the time, let the app launch overnight :) Also, adding more RAM can
help, if your system's started thrashing.
4D(4154,0xb02e9000) malloc: *** error for object 0x4ba1560:
incorrect checksum for freed object - object was probably modified
after being freed.
*** set a breakpoint in malloc_error_break to debug
Its useful, but when I break there, it too late. My buggy code has
misbehaved already, possibly quite a bit ago.
If you can make the process deterministic enough that it always
corrupts the same address, then you could set a gdb watchpoint there
before the corruption occurs and step through the breaks looking for a
backtrace that shouldn't be affecting that block.
—Jens _______________________________________________
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