|
From: Gao, J. <JG...@se...> - 2003-10-08 14:33:06
|
It works for me. I changed the big number to 10, valgrind gives "definitely
lost of 160 bytes". It is precisely correct.
I am using an old valgrind 1.0.4, linux 2.4.20.
Did you try change the big number to a smaller one? Maybe it is a
integer/float overflow problem.
Jiafu
-----Original Message-----
From: Wim Glassee [mailto:wim...@ua...]
Sent: Wednesday, October 08, 2003 10:18 AM
To: val...@li...
Subject: [Valgrind-users] strdup unnoticed
Hi all,
I seem to be having a problem.
Running the code:
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void test()
{
char * test = "ABCDEFGHIJKLMNO";
char * piep;
piep = strdup(test);
piep = strdup(test);
printf( "%s\n", piep );
free(piep);
}
int main( int argc, char ** argv )
{
int i;
for( i = 0; i < 10000000; i++ )
{
test();
}
return 0;
}
should print out the abc... string a zillion times to the screen, while
creating memory leaks on the way.
Running this in valgrind doesn't give ANY program output, and says no leaks
are possible seeing as no malloc has been done. Apparently it doesn't check
inside strdup. This doesn't explain for the no-output problem though.
I used:
valgrind --leak-check=yes --leak-resolution=high
Anybody have any ideas?
Thanks in advance,
Wim
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf _______________________________________________
Valgrind-users mailing list Val...@li...
https://lists.sourceforge.net/lists/listinfo/valgrind-users
This message (including any attachments) contains confidential information
intended for a specific individual and purpose, and is protected by law. If
you are not the intended recipient, you should delete this message. Any
disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
|