Folk:
We are finally moving to gcc 4.0.1 (from 3.3) and have hit a very odd
problem that others on this list may have seen (or may see in the future).
I am posting here as I can only get this to happen in a carbon based GUI
application.
The problem:
As part of debug builds, we override new/delete operators to do leak
checking and all sorts of other good-debugging-love. It appears that with
gcc 4.0.1, overriding new/delete causes problems as system library
allocation calls appear to (periodically?) use our new/delete methods.
I verified that we're doing nothing "odd" by downloading ColorSwatchView,
and modifying it by adding these methods to ColorSwatch.cp:
void* operator new(size_t size) {
return malloc(size);
}
void* operator new[] (size_t size)
{
return malloc(size);
}
void operator delete (void *p) {
if (p) free (p);
}
void operator delete[] (void *p) {
if (p) free (p);
}
Using Xcode 2.2.1 I then put breakpoints at the malloc calls.
In the debugger on PPC, when I hit the "Swap Colors" button, I get a break
point deep inside OS dynamic library load functions. This does not occur in
gcc 3.3.
In the debugger on Intel, I get a breakpoint on launch in
CreateNibReference().
The problem becomes serious as it appears our overrides are not consistantly
called. So in our applications we'll get called for a new, but not the
correspondiing delete. Or we'll get called for a delete on a buffer we
never allocated.
Does this ring any bells with anyone?
-pdc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden