|
From: Wim G. <wim...@ua...> - 2003-10-08 14:18:30
|
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
|
|
From: Olly B. <ol...@su...> - 2003-10-08 14:41:43
|
On Wed, Oct 08, 2003 at 04:17:32PM +0200, Wim Glassee wrote:
> valgrind --leak-check=yes --leak-resolution=high
What version of valgrind? What version of gcc? What gcc command line
options did you use? What version of glibc?
I can't reproduce your problem with valgrind-20030725 and gcc 2.95.4 or
3.3, with -O, -O2, -O3 or without optimisation. That's using glibc 2.2.5.
I get output from the program and memory leaks reported.
Cheers,
Olly
|