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

Re: memory debugging and C++



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:

In file included from /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_alloc.h:54,
                 from /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/alloc.h:21,
                 from /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/bastring.h:39,
                 from /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/string:6,
                 from /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stdexcept:36,
                 from ../comms.hh:25,
                 from Exception.cc:27:
/usr/include/stdlib.h:538: parse error before `*'
make[6]: *** [Exception.lo] Error 1

If I don't delete this code:

#ifdef AAAAAAA
#define malloc(size) \
  _malloc_leap(__FILE__, __LINE__, size)
#undef calloc
#define calloc(count, size) \
  _calloc_leap(__FILE__, __LINE__, count, size)
#undef realloc
#define realloc(ptr, size) \
  _realloc_leap(__FILE__, __LINE__, ptr, size)
#undef recalloc
#define recalloc(ptr, size) \
  _recalloc_leap(__FILE__, __LINE__, ptr, size)
#undef memalign
#define memalign(alignment, size) \
  _memalign_leap(__FILE__, __LINE__, alignment, size)
#undef valloc
#define valloc(size) \
  _valloc_leap(__FILE__, __LINE__, size)
#ifndef DMALLOC_STRDUP_MACRO
#undef strdup
#define strdup(str) \
  _strdup_leap(__FILE__, __LINE__, str)
#endif
#undef free
#define free(ptr) \
  _free_leap(__FILE__, __LINE__, ptr)
#endif AAAAAAAAAA

(the ifdefs are mine, they get rid of the errors)

Personally, I cannot see the problem...

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?
-- 
Brian May <bam@snoopy.apana.org.au>



Reply to: