[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: valgrind



Good day,

Le dimanche 03/20/05 Graham Wilson <graham@mknod.org> a écrit :
> > I've seen there is a experimental port of valgrind. Anybody tested it ?
> 
> I've used it a few times, and it seemed to work alright. The only
> problem I noticed was that the supressions weren't correct for the
> libraries I was using.

Which version of valgrind-ppc have you tried?

I'm trying 2.2.0-ppc from http://ozlabs.org/~paulus/ but I'm not able to
make it find any overflow nor memory leak :

djoume@gotan:~/src$ cat test-valgrind.c 
#include <stdlib.h>

void f(void) {
  int* x = malloc(10 * sizeof(int));
  x[10] = 0;        // problem 1: heap block overrun
}                    // problem 2: memory leak -- x not freed

int main(void) {
  f();
  return 0;
}
djoume@gotan:~/src$ gcc -g -W -Wall test-valgrind.c -o test-valgrind
djoume@gotan:~/src$ valgrind --tool=memcheck --leak-check=yes ./test-valgrind
==6540== Memcheck, a memory error detector for Linux.
==6540== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==6540== Using valgrind-2.2.0-ppc, a program supervision framework for Linux.
==6540== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==6540== For more details, rerun with: -v
==6540== 
==6540== 
==6540== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 1)
==6540== malloc/free: in use at exit: 0 bytes in 0 blocks.
==6540== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==6540== For counts of detected errors, rerun with: -v
==6540== No malloc'd blocks -- no leaks are possible.
djoume@gotan:~/src$ 

Regards.
-- 
Djoumé SALVETTI



Reply to: