[PATCH] Slightly better way to __USE_MALLOC

Loren James Rittle rittle@latour.rsch.comm.mot.com
Wed Oct 9 16:27:00 GMT 2002


> Hi, all..  When debugging recently, I found it necessary to use a 
> __USE_MALLOCed version of the library.  Having followed the
> discussions about this topic a while back, I was aware that doing this
> is somewhat clumsy and (perhaps) error-prone.  After I had actually
> rebuilt the library (and found my bug quite quickly with "mpatrol",
> BTW), I decided that it might be useful to have a malloc-using version
> of the library "hanging around".  Since "a patch would be
> appreciated", here's one, albeit not a perfect one. [...]

Hi Brad,

A patch that rid us entirely of an ABI-affecting macro would be
perfect but you already noted that your patch wasn't perfect... ;-)

However, I am afraid that you didn't test well enough the various
cases which exist.  Please try compiling your posted test case at -O2
(and of course removing the c++config check I added, and as you
propose to do with your patch).  The program is linkable without an
error yet there is a mismatch between memory allocation
implementations.  I will post a multi-file test case which blows up
when compiled in a mismatched manner, if it will help you fully
understand the broader issue.

The check was added due to user reports of non-detectable errors (of
course, we had to figure out what the root issue was since it wasn't
obvious at first).  I really don't want to make it easy for users to
build a program with a non-detectable (at build-time) error.

All that said, please continue to work on this problem, if you can.
Don't worry about the form the patch needs to be in to commit; I can
help with all that cleanup later.

Regards,
Loren
-- 
Loren J. Rittle, Principal Staff Engineer, Motorola Labs (IL02/2240)
rittle@labs.mot.com, KeyID: 2048/ADCE34A5, FDC0292446937F2A240BC07D42763672



More information about the Libstdc++ mailing list