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: cocoa app using external c++ code



What does the destructor of Otherclass do?


Paul Forgey wrote:
I have a cocoa app written using objc++ using external c++ code. Any external classes allocated via new crash the heap if I delete them. If I enable Guard Malloc I get this message:

GuardMalloc[Administration Console-1883]: Tried to free pointer at 0xb161d6cc which is not currently a pointer to a malloc buffer.
GuardMalloc[Administration Console-1883]: Explicitly trapping into debugger!!!


Which pretty much agrees with what malloc_printf complains about with it turned off. I know for a fact I am not disturbing the state of the heap, as I can cause this to happen first thing in main before running any actual code:

// main.mm

int main (int argc, char *argv[])
{
  Otherclass *x = new Otherclass ();
  delete x; // CRASH
  ..
}

What's going on?? I can't find any compiler options XCode is setting that would disturb alignment or anything. In fact my working C++ command line programs all see the same sizes and layouts the cocoa app does.


------------------------------------------------------------------------

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

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

This email sent to 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.