|
From: Haobing W. <hw...@ep...> - 2003-08-12 17:35:41
|
On Tue, 2003-08-12 at 12:06, Matthew Emmerton wrote: > ----- Original Message ----- > From: "Haobing Wang" <hw...@ep...> > To: <val...@li...> > Sent: Tuesday, August 12, 2003 11:34 AM > Subject: [Valgrind-users] What is the problem? > > > > Hello, > > > > When I used "valgrind --leak-check=yes" to check my C program, it gave > > such information: > > > > ==2363== Invalid read of size 4 > > ==2363== at 0x8049949: main (gating_grinder2J.c:410) > > ==2363== by 0x40279A46: __libc_start_main (in /lib/libc-2.3.2.so) > > ==2363== by 0x80487C0: ??? (start.S:81) > > ==2363== Address 0x41209920 is 0 bytes after a block of size 528 > > alloc'd > > ==2363== at 0x4002942A: malloc (vg_replace_malloc.c:153) > > ==2363== by 0x8049025: main (gating_grinder2J.c:247) > > ==2363== by 0x40279A46: __libc_start_main (in /lib/libc-2.3.2.so) > > ==2363== by 0x80487C0: ??? (start.S:81) > > Done. > > > > ==2363== > > ==2363== ERROR SUMMARY: 4096 errors from 1 contexts (suppressed: 0 from > > 0) > > ==2363== malloc/free: in use at exit: 19081 bytes in 8 blocks. > > ==2363== malloc/free: 91010 allocs, 91002 frees, 45431125 bytes > > allocated. > > ==2363== For counts of detected errors, rerun with: -v > > ==2363== searching for pointers to 8 not-freed blocks. > > ==2363== checked 3802352 bytes. > > ==2363== > > ==2363== LEAK SUMMARY: > > ==2363== definitely lost: 0 bytes in 0 blocks. > > ==2363== possibly lost: 0 bytes in 0 blocks. > > ==2363== still reachable: 19081 bytes in 8 blocks. > > ==2363== suppressed: 0 bytes in 0 blocks. > > ==2363== Reachable blocks (those to which a pointer was found) are not > > shown. > > ==2363== To see them, rerun with: --show-reachable=yes > > ==2363== > > > > > > Does anybody know what is the problem with the error? I couldn't find > > any error in my program and it seemed that the program could run > > normally. The line 247 in main is: > > vec_rows[k] = (float *)malloc(Timepts*sizeof(float)) > > > > Any help is much appreciated! > > Does your program call free(vec_rows[k]) at some point in time? Yes, I called free(vec_rows[k]) at the end of my program, but I wrote past the end of that memory before freeing it. Thank you anyway! > > -- > Matt Emmerton > |