Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Mar 2011 09:26:00 +0200
From:      David Demelier <demelier.david@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   printf() leak?
Message-ID:  <4D918988.8090802@gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D918988.8090802>