Re: Debugging memory corruption? (C++)
Re: Debugging memory corruption? (C++)
- Subject: Re: Debugging memory corruption? (C++)
- From: Jean-Denis Muys <email@hidden>
- Date: Mon, 02 Nov 2009 00:20:46 +0100
On Nov 1, 2009, at 19:41 , Dave Carrigan wrote:
On Nov 1, 2009, at 10:33 AM, Jean-Denis Muys wrote:
Since all std::auto_ptr does is to call delete on its internal
pointer when it goes out of scope (even in case of an exception), I
am still totally puzzled by this behaviour.
It would be interesting to see if you still get the error if you use
the first code without the auto_ptr, but move the delete operation
after the call to zoneCheck() .
This is what is happening with the auto_ptr - its destructor (and
hence the delete) is called at the end of the function, which is
after the call to zoneCheck().
--
Dave Carrigan
email@hidden
Seattle, WA, USA
zonecheck() is a no-op: it's my hack to call malloc()'s heap-
validation routine.
On Nov 1, 2009, at 19:41 , Marshall Clow <email@hidden> wrote:
To me, that suggests that looking at the destructor for
sql::ResultSet.
-- Marshall
Indeed, memory corruption happens in there, deep in there. MySQL
publishes the source code, but it's rather large and convoluted. I
tried to trace it a bit, and I witnessed it corrupt a free block when
delete was call by me, while not when called by auto_ptr.
Again, zoneCheck() is my debugging hack: it calls the routine that
malloc() itself calls when you set the MallocCheckHeapStart and
MallocCheckHeapEach environment variables. It's not exposed to be
called explicitly, but it was invaluable to me to break as soon as
memory corruption occurred.
Otherwise, zoneCheck() doesn't do anything, and it's even compiled to
inline void() {} in a release build.
So to me the mystery remains, even though my code is working again.
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