printf() leak?

David Demelier demelier.david at gmail.com
Tue Mar 29 07:26:05 UTC 2011


Hello,

It seems printf() always alloc something and does not free it:

#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
     printf("Hi\n");
     return 0;
}

and valgrind ./a.out:

==67840==
==67840== HEAP SUMMARY:
==67840==     in use at exit: 4,096 bytes in 1 blocks
==67840==   total heap usage: 1 allocs, 0 frees, 4,096 bytes allocated
==67840==
==67840== LEAK SUMMARY:
==67840==    definitely lost: 0 bytes in 0 blocks
==67840==    indirectly lost: 0 bytes in 0 blocks
==67840==      possibly lost: 0 bytes in 0 blocks
==67840==    still reachable: 0 bytes in 0 blocks
==67840==         suppressed: 4,096 bytes in 1 blocks

(The experience on Linux does not leak)

Cheers,

-- 
David Demelier


More information about the freebsd-questions mailing list