This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Building a C++ program with -D__USE_MALLOC

> > 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
> this.
> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]