[rfc] Provide separate operator vector new and delete in msvcrt; let valgrind check them

Dan Kegel dank at kegel.com
Tue Dec 15 09:11:54 CST 2009


First draft for discussion.  Not, um, well tested yet.

ANSI C++ mandates separate vector versions of new and delete
that do the same thing as the non-vector versions, but which can
be replaced by user apps (see
http://www.csci.csusb.edu/dick/c++std/cd2/lib-support.html#lib.new.delete )
So far, so good; wine does that in msvcrt.

However, once in a while, a programmer will call delete when he
should have called delete[], and a bunch of destructors won't
get called.  To detect this programming error, let's split
the vector new and delete functions off from their scalar twins,
and add values for the heap function flags so we can inform
valgrind what kind of blocks are being wrangled.

This means picking two flag bits that Microsoft doesn't use;
there seem to be enough to go around.

Requires the corresponding patch to valgrind
ttps://bugs.kde.org/show_bug.cgi?id=218741

Thanks to Steve Vandebogart for his help on this; he wrote a bunch of it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: split.patch
Type: text/x-patch
Size: 2589 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20091215/6ce1536e/attachment.bin>


More information about the wine-devel mailing list