dwww Home | Show directory contents | Find package

From: Martin Krumpolec
Sent: Tuesday, June 23, 1998 1:11 PM
Subject: RE: dmalloc - bug report ?

> The problem seems to be that certain libc calls which allocate
> memory (strdup for instance) somehow bypass the malloc() call and do
> their own allocations.  This confuses dmalloc when the free is called.

Hello,
 
I have observed this problem is regarding not only strdup but several
other libc (AIX 4.2) routines allocating memory: scandir, strdup,
tempnam, ... When I played a bit, I have found neat idea in the man
pages - they adviced to add flags:

        -bnso -bI:/lib/syscalls.exp

to linker options in AIX ... Voila, it suddenly works :)

Martin
 
 
> -----Original Message-----
>
>
> > k>   s.p = (char *) strdup("blah");
> > k>   free((void *) s.p);
>
> > Huh?  No a bug with libdmalloc I don't think.  Looks to me
> that strdup
> > is not calling malloc at all.  See the 1: before the free
> error in the
> > logfile?  This indicates that it is the first time that the library
> > has been called.  This is very strange.  Strdup should not be using
> > its own allocator but who knows.
>
>   It seems you are right. I have replaced strdup with malloc
>   and it went ok ... On my Linux box it works with strdup, so
>   conclusion is the AIX's libc has weird implementation of strdup
>   (man page says it uses malloc, but it evidently lies)

Generated by dwww version 1.15 on Thu May 23 11:17:31 CEST 2024.