On Mon, 19 Jul 1999, Gray Watson wrote:
> loic@... wrote:
> >
> > I would like to blacklist a list of 'ra=0x4013195c'. I would
> > be *very* usefull to shut-up numerous leaks from standard C library.
> > Is there a way to do that ?
>
> Currently there is no way to do this. Good idea however that I will add
> into the TODO list.
Just so you know, _sometimes_ those leaks from the standard C library
are misuses of the library... As an example, here on Solaris 5.6,
if you run this program:
int main(int argc,char *argv[]) {
char *p = malloc(1);
FILE *fp = fopen("/tmp/logfile","a");
fprintf(fp,"Hello\n");
if (p) free(p); p = NULL;
return(0);
}
The p bit is necessary, because otherwise, for some reason it doesn't
emit a log file at all... (Gray?) Anyhow, it reports
932407752: 3: Unfreed allocations:
932407752: 3: total-size count source
932407752: 3: 8200 1 ra=0xef6e3b58
932407752: 3: 8200 1 Total of 1
932407752: 3: unknown memory not freed: 1 pointer, 8200 bytes
But, this is because the file fp was never closed. If you fclose(fp);
then the leak goes away... Look long and hard before deciding it's in
the Standard C library... (The example may seem contrived, but I don't
think it really is... Plenty of code I've seen allocates a global
debug or log file, and never close it under any circumstance...)
I'd rather deal with the devil I see, than ignore him, if possible
is all...
But, the fact that if I don't put in the malloc line makes it so
that no logfile is generated kind of worries me... What's up with
that? I thought -ldmalloc would use it's own malloc library, so
it would put the whole atexit bit and everything, no?
Binesh Bannerjee
> --
> gray@...
>
* There's nothing wrong with me... http://www.panix.com/~binesh *
* There's something wrong with the universe. http://www.hex21.com/ *
* 'One of the cultural barriers that separates CGI/Java Consulting *
* computer scientists from "regular" scientists and engineers is ... the *
* practical scientist is trying to solve tomorrow's problem with *
* yesterday's computer; the computer scientist, we think, often has it the *
* other way around.' - Numerical Recipes in C *
------------------------------------------------------------------------
eGroups.com home: http://www.egroups.com/group/dmalloc
http://www.egroups.com - Simplifying group communications