$ cat test.cpp #include #include #if 0 typedef std::set Set; #else typedef boost::unordered_set Set; #endif Set* set = NULL; int main() { set = new Set(); set->insert(1); // delete set; } ---------------------------------------------------------- $ valgrind --leak-check=full ./a.out ==12588== Memcheck, a memory error detector ==12588== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==12588== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info ==12588== Command: ./a.out ==12588== ==12588== ==12588== HEAP SUMMARY: ==12588== in use at exit: 208 bytes in 3 blocks ==12588== total heap usage: 3 allocs, 0 frees, 208 bytes allocated ==12588== ==12588== 24 bytes in 1 blocks are possibly lost in loss record 1 of 3 ==12588== at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==12588== by 0x40296C: __gnu_cxx::new_allocator >::allocate(unsigned long, void const*) (new_allocator.h:104) ==12588== by 0x4024F0: boost::unordered::detail::allocator_traits > >::allocate(std::allocator >&, unsigned long) (allocate.hpp:553) ==12588== by 0x401E79: boost::unordered::detail::node_constructor > >::construct() (buckets.hpp:419) ==12588== by 0x401853: void boost::unordered::detail::node_constructor > >::construct_with_value >(boost::unordered::detail::emplace_args1 const&) (buckets.hpp:359) ==12588== by 0x40139C: std::pair >, bool> boost::unordered::detail::table_impl, int, boost::hash, std::equal_to > >::emplace_impl >(int const&, boost::unordered::detail::emplace_args1 const&) (unique.hpp:407) ==12588== by 0x400F5E: std::pair >, bool> boost::unordered::detail::table_impl, int, boost::hash, std::equal_to > >::emplace(boost::unordered::detail::emplace_args1 const&) (unique.hpp:391) ==12588== by 0x400DC4: std::pair, boost::unordered::detail::ptr_node const*>, bool> boost::unordered::unordered_set, std::equal_to, std::allocator >::emplace(int const&) (unordered_set.hpp:279) ==12588== by 0x400CFC: boost::unordered::unordered_set, std::equal_to, std::allocator >::insert(int const&) (unordered_set.hpp:382) ==12588== by 0x400A96: main (test.cpp:14) ==12588== ==12588== LEAK SUMMARY: ==12588== definitely lost: 0 bytes in 0 blocks ==12588== indirectly lost: 0 bytes in 0 blocks ==12588== possibly lost: 24 bytes in 1 blocks ==12588== still reachable: 184 bytes in 2 blocks ==12588== suppressed: 0 bytes in 0 blocks ==12588== Reachable blocks (those to which a pointer was found) are not shown. ==12588== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==12588== ==12588== For counts of detected and suppressed errors, rerun with: -v ==12588== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)