Search the web
Sign In
New User? Sign Up
dmalloc · Debug Malloc Library (dmalloc) Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Checkpoints?   Message List  
Reply | Forward Message #82 of 529 |
[dmalloc] Re: Checkpoints?

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






Mon Jul 19, 1999 6:16 pm

binesh@...
Send Email Send Email

Forward
Message #82 of 529 |
Expand Messages Author Sort by Date

Hi, I've just started using dmalloc, and I have a question: I would like to define "checkpoints" in my code and measure memory leaks within two checkpoints. ...
kintel@...
Send Email
Jul 16, 1999
4:50 pm

... Currently there is no way to do this. Good idea however that I will add into the TODO list. -- gray@... ... eGroups.com home:...
Gray Watson
gray@...
Send Email
Jul 19, 1999
6:02 pm

... 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...
Binesh Bannerjee
binesh@...
Send Email
Jul 19, 1999
7:24 pm

... There are two issues here. THe first is that the linker will not cause the malloc objects from dmalloc to be loaded unless they are undefined in your test...
Gray Watson
gray@...
Send Email
Jul 19, 1999
11:03 pm

... Alright, that's fair... I guess I've never hit on it till now, because, I've never written a program that didn't directly call malloc... (Well, I have, but...
Binesh Bannerjee
binesh@...
Send Email
Jul 22, 1999
8:19 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help