Hi,

Woops, sorry about my other "asdf" spam email.. :-)

This might be a stupid/obvious question but dmalloc is reporting that I have
a memory leak in the following (test) program and I don't know why:

#include <stdio.h>
#include <stdlib.h>
#include <dmalloc.h>

int main(int argc, char **argv)
{
   char *c = malloc(10);
   strcpy(c, "hello");
   printf("c=%s\n", c);
   free(c);
   return 1;
}

dmalloc is installed in my account and I compiled it with:

gcc -g test.c -o test /home/izzo/usr/lib/libdmalloc.a -I/home/izzo/usr/include

I set dmalloc up with:

dmalloc -i 200 -l dmlog high

and at the end of my log file (snipped for brevity) is:

1045066226: 3:  total-size  count in-use-size  count  source
1045066226: 3:        4096      1        4096      1  ra=0x280e57ec
1045066226: 3:          10      1           0      0  test.c:7
1045066226: 3:        4106      2        4096      1  Total of 2
1045066226: 3: dumping not-freed pointers changed since 0:
1045066226: 3:  not freed: '0x808f008|s1' (4096 bytes) from 'ra=0x280e57ec'
1045066226: 3:  total-size  count  source
1045066226: 3:        4096      1  ra=0x280e57ec
1045066226: 3:        4096      1  Total of 1
1045066226: 3:  unknown memory: 1 pointer, 4096 bytes

Supposedly there is a 4096 byte memory leak.  The same program on my Slackware
Linux box reports no leaks.  I'm using 4.7-RELEASE. Does anyone have any ideas?
The same program on a friend's 4.5-RELEASE box reports a 1024 byte leak. Is
dmalloc just not FreeBSD-friendly?

Thanks
sam


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to