This is the mail archive of the
mailing list for the GCC project.
Re: Building a C++ program with -D__USE_MALLOC
- To: martin at mira dot isdn dot cs dot tu-berlin dot de (Martin v. Loewis)
- Subject: Re: Building a C++ program with -D__USE_MALLOC
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Wed, 3 Nov 99 14:20:45 PST
- Cc: yumf at ultimatech dot com, gcc at gcc dot gnu dot org, yumf at iago dot ultimatech dot com
> > If this is not the official way to run purify, please let me know what
> > is the right way to do this.
> You did not mention what platform you are using, so it is hard to tell
> how you have to run purify - please read the purify documentation for
> On Solaris, I *never* use -D__USE_MALLOC to run purify. I just run it
> in the final linker pass. Purify will, on its own, determine what the
> allocation functions are; in particular, it will know what
> __builtin_new is, and compute memory statistics based on that.
You're missing the point, Martin. The default allocator does not call
__builtin_new directly, rather, it uses __default_alloc_template,
so that if it is used, some Purify errors (eg array-out-of-bounds) will
be missed, since many allocations will share one malloc/new call.
It is really too bad that the default allocator gets wired in to the name
mangling of the string type. One possibility that I haven't tried
(which will break link compatibility, unfortunately), is to modify
stl_alloc.h to make "alloc" a derived class, rather than a typedef.
(This handling of the default allocator in libstdc++ v2 is nonstandard