Hallo,
ich habe ein lustige Phänomen: printf (oder puts) scheint 4kb zu allozieren (einmalig, egal, wie oft man die Funktionen aufruft), aber nicht mehr freizugeben (FreeBSD 8.0). Unter Linux (Gentoo + Ubuntu) tritt das Verhalten nicht auf:
Code
Valgrind (FreeBSD)
Valgrind (Gentoo)
Kompiliert wird mit
Kennt das jemand? Ist das irgendwie definiert oder könnte es sich um einen Fehler handeln?
Viele Grüße, Morfio
ich habe ein lustige Phänomen: printf (oder puts) scheint 4kb zu allozieren (einmalig, egal, wie oft man die Funktionen aufruft), aber nicht mehr freizugeben (FreeBSD 8.0). Unter Linux (Gentoo + Ubuntu) tritt das Verhalten nicht auf:
Code
Code:
#include <stdio.h>
int main() {
printf("Hallo Welt\n");
return 0;
}
Valgrind (FreeBSD)
$ valgrind --leak-check=full --show-reachable=yes ./a.out
==20198== Memcheck, a memory error detector
==20198== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==20198== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==20198== Command: ./a.out
==20198==
Hallo Welt
==20198==
==20198== HEAP SUMMARY:
==20198== in use at exit: 4,096 bytes in 1 blocks
==20198== total heap usage: 1 allocs, 0 frees, 4,096 bytes allocated
==20198==
==20198== LEAK SUMMARY:
==20198== definitely lost: 0 bytes in 0 blocks
==20198== indirectly lost: 0 bytes in 0 blocks
==20198== possibly lost: 0 bytes in 0 blocks
==20198== still reachable: 0 bytes in 0 blocks
==20198== suppressed: 4,096 bytes in 1 blocks
==20198==
==20198== For counts of detected and suppressed errors, rerun with: -v
==20198== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Valgrind (Gentoo)
valgrind ./a.out
==20844== Memcheck, a memory error detector.
==20844== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==20844== Using LibVEX rev 1804, a library for dynamic binary translation.
==20844== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==20844== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework.
==20844== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==20844== For more details, rerun with: -v
==20844==
Hallo Welt
==20844==
==20844== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 1)
==20844== malloc/free: in use at exit: 0 bytes in 0 blocks.
==20844== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==20844== For counts of detected errors, rerun with: -v
==20844== All heap blocks were freed -- no leaks are possible.
Kompiliert wird mit
gcc -Wall -g test.c
Kennt das jemand? Ist das irgendwie definiert oder könnte es sich um einen Fehler handeln?
Viele Grüße, Morfio
