|
From: Salim S. <ssa...@ti...> - 2003-11-21 18:19:41
|
Hello all, I'm trying to run valgrind on my stack. Unfortunately it fails all time when calling a function in the Judy lib (C libraries for creating and accessing dynamic arrays: http://judy.sourceforge.net/) I wonder if someone has success doing this (running valgrind on a code using Judy array)? I make a small test on which there is a call to the Judy lib. It works fine but when I run it with valgrind ... It fails.!! Here the test: /*************************************************************************** */ #include <unistd.h> #include <stdio.h> #include <string.h> #include <Judy.h> #define MAXLINE 65536 // max string (line) len int main() { Pvoid_t PJArray = (PWord_t)NULL; // Judy array. PWord_t PValue; // Judy array element. Word_t Bytes; // size of JudySL array. char Index[MAXLINE]; // string to check uint32_t i=0; while ((fgets(Index, sizeof(Index), stdin) != "")&&(i++<5) ) { JSLI(PValue, PJArray, Index); // store string into array if (PValue == PJERR) // if out of memory? { // so do something printf("ERROR \n"); exit(1); } ++(*PValue); // count instances of string } Index[0] = '\0'; // start with smallest string. JSLF(PValue, PJArray, Index); // get first string while (PValue != NULL) { while ((*PValue)--) // print duplicates printf("%s", Index); JSLN(PValue, PJArray, Index); // get next string } JSLFA(Bytes, PJArray); // free array fprintf(stderr, "The JudySL array used %lu bytes of memory\n", Bytes); return (0); } /*************************************************************************** */ Many thanks in advance for your reply. All the best, salim PS: I'm working on : + RedHat Advanced Server 2.1 machine, + proc: IA32 + uname -a Linux host_1 2.4.9-e.24smp #1 SMP Tue May 27 16:07:39 EDT 2003 i686 unknown and using the last version of valgrind 2.0.0. Valgrind report is attached |