RAII

    1. $ rustc raii.rs && valgrind ./raii
    2. ==26873== Memcheck, a memory error detector
    3. ==26873== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
    4. ==26873== Command: ./raii
    5. ==26873==
    6. ==26873==
    7. ==26873== HEAP SUMMARY:
    8. ==26873== total heap usage: 1,013 allocs, 1,013 frees, 8,696 bytes allocated
    9. ==26873==
    10. ==26873== All heap blocks were freed -- no leaks are possible
    11. ==26873==
    12. ==26873== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)