Also, if you compile with `-d:useMalloc` and run under valgrind (I did it with 
ARC) you can clearly see this: 
    
    
    ==30089== Memcheck, a memory error detector
    ==30089== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==30089== Using Valgrind-3.16.0.GIT and LibVEX; rerun with -h for copyright 
info
    ==30089== Command: ./b
    ==30089==
    @[(r: 0, i: 861925), (r: 0, i: 1018886), (r: 0, i: 1112145), (r: 0, i: 
3095791), (r: 0, i: 3127185)] ... @[(r: 1000000, i: 5801839), (r: 1000000, i: 
6467043), (r: 1000000, i: 6768282), (r: 1000000, i: 7387067), (r: 1000000, i: 
8454119)]
    ==30089==
    ==30089== HEAP SUMMARY:
    ==30089==     in use at exit: 0 bytes in 0 blocks
    ==30089==   total heap usage: 53 allocs, 53 frees, 120,003,383 bytes 
allocated
    ==30089==
    ==30089== All heap blocks were freed -- no leaks are possible
    ==30089==
    ==30089== For lists of detected and suppressed errors, rerun with: -s
    ==30089== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
    
    
    Run

Reply via email to