[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: memory debugging and C++

On Sun, 29 Sep 2002 13:19:52 +1000
Brian May <bam@snoopy.apana.org.au> wrote:

> On Sun, Sep 29, 2002 at 01:05:36PM +1000, Glenn McGrath wrote:
> > I havent tried dmalloc with c++, but i havent had any problems using
> > it with c.
> > 
> > Do you have any more details about whats broken about the include file
> > ?
> I get heaps of errors like:
> Personally, I cannot see the problem...

dmalloc works by intercepting the *alloc calls and using its own
functions, i suspect this is causing problem becasue stdlib.h is trying to
do the same thing.

If stdlib.h redefines *alloc to *alloc_leap then dmalloc wont see them if
it tries to redefine them afterwards... which i think make sense if you
are #including <stdlib.h> prior to #including <dmalloc.h>.... could be
worth a try reversing the order, including dmalloc.h first.

(i dont know c++ so i could be totally wrong).

> Also for C++, I wasn't clear why there are wrapper scripts in
> /usr/doc/dmalloc/c++/*, and how to include these (I would rather not
> have to change my source code extensively to accommadate dmalloc if
> possible). Why can't dmallocc.cc be distributed in compiled form?

The info page has a small section relating to usage with c++, apparently
your supposed to compile and link dmalloc.cc with the program your trying
to debug, it intercepts c++'s new and delete functions.


Reply to: