• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Debugging memory corruption? (C++)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging memory corruption? (C++)


  • Subject: Re: Debugging memory corruption? (C++)
  • From: Jean-Denis Muys <email@hidden>
  • Date: Tue, 03 Nov 2009 01:01:24 +0100


On Nov 3, 2009, at 0:00 , Jens Alfke wrote:


On Nov 2, 2009, at 2:25 PM, Jean-Denis Muys wrote:

Well, I thought I had solved my memory corruption bug. Not so fast! It still seems to happen. I have managed to trace the crash in mySQL C++/Connector to the call of a destructor at exit of the routine listed below. And according to *my* understanding of C++ that destructor should not have been called from that routine, because, the destructor is not called on an automatic variable, but on a data member of this.

Actually the destructor should be called. The method you posted is a constructor, and when an exception is thrown out of a constructor, the matching destructor is invoked so the object gets cleaned up. The member result_bind is an auto_ptr member of your class, so it gets destructed as part of your class's destructor.

From the code, it looks as though r_bind may be a bogus pointer on entry and that's why the free() call in the auto_ptr's destructor crashes? 

—Jens

Darn you are right. But no, r_bind is not bogus. But this pointer is *also* in an auto_ptr in the caller's stack frame. And putting the same pointer into *two* auto_ptr is inviting the world to collapse. In my case, Murphy made sure it did.

Thanks for the help.

Now to my second question, I found otool, but its symbols are the mangled C++ proc names.

Next try is to add the -S option to gcc, but I couldn't find a way to do that in XCode. How can I do that?

Thanks,

Jean-Denis

 _______________________________________________
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

  • Follow-Ups:
    • Re: Debugging memory corruption? (C++)
      • From: Jens Alfke <email@hidden>
References: 
 >Re: Debugging memory corruption? (C++) (From: Jean-Denis Muys <email@hidden>)
 >Re: Debugging memory corruption? (C++) (From: Dave Carrigan <email@hidden>)
 >Re: Debugging memory corruption? (C++) (From: Jean-Denis Muys <email@hidden>)
 >Re: Debugging memory corruption? (C++) (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Version Control [was: Damaging the source code]
  • Next by Date: Re: Debugging memory corruption? (C++)
  • Previous by thread: Re: Debugging memory corruption? (C++)
  • Next by thread: Re: Debugging memory corruption? (C++)
  • Index(es):
    • Date
    • Thread