|
From: Verdi M. <ver...@co...> - 2006-06-19 16:34:53
|
Hi,
valgrind reported the following as "definite lost". I thought this is
the case of "still reachable", because I still hold a pointer to the
allocated memory? At least this is what I understand from the user
manual.
I'm using suse 10.1 (32-bit version): valgrind-3.2.0-11.1,
kernel-smp-2.6.16.13-4, glibc-2.4-31, and gcc-4.1.0-25.
/***********************************/
#include <stdio.h>
#include <stdlib.h>
int main() {
int *ip;
ip =(int *) malloc(sizeof(int));
return 0;
}
/***********************************/
/*********************************************************************/
$ valgrind --leak-check=yes ./a.out
==27277== Memcheck, a memory error detector.
==27277== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et
al.
==27277== Using LibVEX rev 1606, a library for dynamic binary
translation.
==27277== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==27277== Using valgrind-3.2.0, a dynamic binary instrumentation
framework.
==27277== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et
al.
==27277== For more details, rerun with: -v
==27277==
==27277==
==27277== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 1)
==27277== malloc/free: in use at exit: 4 bytes in 1 blocks.
==27277== malloc/free: 1 allocs, 0 frees, 4 bytes allocated.
==27277== For counts of detected errors, rerun with: -v
==27277== searching for pointers to 1 not-freed blocks.
==27277== checked 56,636 bytes.
==27277==
==27277== 4 bytes in 1 blocks are definitely lost in loss record 1 of 1
==27277== at 0x4021396: malloc (vg_replace_malloc.c:149)
==27277== by 0x80483D0: main (cobi.c:6)
==27277==
==27277== LEAK SUMMARY:
==27277== definitely lost: 4 bytes in 1 blocks.
==27277== possibly lost: 0 bytes in 0 blocks.
==27277== still reachable: 0 bytes in 0 blocks.
==27277== suppressed: 0 bytes in 0 blocks.
==27277== Reachable blocks (those to which a pointer was found) are not
shown.
==27277== To see them, rerun with: --show-reachable=yes
/*********************************************************************/
--
Regards,
Verdi
|