------- Comment #6 from dominiq at lps dot ens dot fr 2009-09-27 11:45 ------- > Works for me on FreeBSD.
Is anyone understanding why? valgrind gives: ==77290== Invalid free() / delete / delete[] ==77290== at 0x167FB: free (vg_replace_malloc.c:323) ==77290== by 0x2EAE: MAIN__ (in ./pr41478.ex) ==77290== by 0x2F0F: main (in ./pr41478.ex) ==77290== Address 0x3e15c0 is 0 bytes inside a block of size 4 free'd ==77290== at 0x167FB: free (vg_replace_malloc.c:323) ==77290== by 0x2E53: MAIN__ (in ./pr41478.ex) ==77290== by 0x2F0F: main (in ./pr41478.ex) ==77290== ==77290== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) ==77290== malloc/free: in use at exit: 448 bytes in 11 blocks. ==77290== malloc/free: 30 allocs, 20 frees, 3,482 bytes allocated. ==77290== For counts of detected errors, rerun with: -v ==77290== searching for pointers to 11 not-freed blocks. ==77290== checked 833,028 bytes. ==77290== ==77290== ==77290== 4 bytes in 1 blocks are definitely lost in loss record 1 of 4 ==77290== at 0x15516: malloc (vg_replace_malloc.c:193) ==77290== by 0x257B: MAIN__ (in ./pr41478.ex) ==77290== by 0x2F0F: main (in ./pr41478.ex) ==77290== ==77290== LEAK SUMMARY: ==77290== definitely lost: 4 bytes in 1 blocks. ==77290== indirectly lost: 0 bytes in 0 blocks. ==77290== possibly lost: 0 bytes in 0 blocks. ==77290== still reachable: 444 bytes in 10 blocks. ==77290== suppressed: 0 bytes in 0 blocks. ==77290== Reachable blocks (those to which a pointer was found) are not shown. ==77290== To see them, rerun with: --leak-check=full --show-reachable=yes -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41478