Leaks in libc?

Gary Jennejohn gary.jennejohn at freenet.de
Wed Jan 27 15:43:19 UTC 2010


On Wed, 27 Jan 2010 08:18:43 -0600
Brandon Falk <falkman at gamozo.org> wrote:

> The simple program:
> 
> #include <stdlib.h>
> #include <stdio.h>
> 
> int main()
> {
>         puts("Apple cider");
>         return 0;
> }
> 
> Yields the following result in valgrind:
> 
> ==4703== Memcheck, a memory error detector
> ==4703== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
> ==4703== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
> ==4703== Command: ./a.out
> ==4703==
> Apple cider
> ==4703==
> ==4703== HEAP SUMMARY:
> ==4703==     in use at exit: 4,096 bytes in 1 blocks
> ==4703==   total heap usage: 1 allocs, 0 frees, 4,096 bytes allocated
> ==4703==
> ==4703== LEAK SUMMARY:
> ==4703==    definitely lost: 0 bytes in 0 blocks
> ==4703==    indirectly lost: 0 bytes in 0 blocks
> ==4703==      possibly lost: 0 bytes in 0 blocks
> ==4703==    still reachable: 0 bytes in 0 blocks
> ==4703==         suppressed: 4,096 bytes in 1 blocks
> ==4703==
> ==4703== For counts of detected and suppressed errors, rerun with: -v
> ==4703== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
> 
> Any ideas why the standard libraries are leaking like this? Is it 
> perhaps a bug with valgrind, or maybe FreeBSD automatically cleans up so 
> they took the cleanup out of their libc?
> 
> FreeBSD 8.0 x86_64
> 

From the valgrind FAQ
"suppressed" means that a leak error has been suppressed. There are some
suppressions in the default suppression files. You can ignore suppressed
errors.

AFAIK all variants of U*X recover memory used by applications when the
applications exit.  This is not a real leak.

---
Gary Jennejohn


More information about the freebsd-hackers mailing list