Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat test.cpp
- #include <set>
- #include <boost/unordered_set.hpp>
- #if 0
- typedef std::set<int> Set;
- #else
- typedef boost::unordered_set<int> 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<boost::unordered::detail::ptr_node<int> >::allocate(unsigned long, void const*) (new_allocator.h:104)
- ==12588== by 0x4024F0: boost::unordered::detail::allocator_traits<std::allocator<boost::unordered::detail::ptr_node<int> > >::allocate(std::allocator<boost::unordered::detail::ptr_node<int> >&, unsigned long) (allocate.hpp:553)
- ==12588== by 0x401E79: boost::unordered::detail::node_constructor<std::allocator<boost::unordered::detail::ptr_node<int> > >::construct() (buckets.hpp:419)
- ==12588== by 0x401853: void boost::unordered::detail::node_constructor<std::allocator<boost::unordered::detail::ptr_node<int> > >::construct_with_value<boost::unordered::detail::emplace_args1<int> >(boost::unordered::detail::emplace_args1<int> const&) (buckets.hpp:359)
- ==12588== by 0x40139C: std::pair<boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<int> >, bool> boost::unordered::detail::table_impl<boost::unordered::detail::set<std::allocator<int>, int, boost::hash<int>, std::equal_to<int> > >::emplace_impl<boost::unordered::detail::emplace_args1<int> >(int const&, boost::unordered::detail::emplace_args1<int> const&) (unique.hpp:407)
- ==12588== by 0x400F5E: std::pair<boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<int> >, bool> boost::unordered::detail::table_impl<boost::unordered::detail::set<std::allocator<int>, int, boost::hash<int>, std::equal_to<int> > >::emplace<int>(boost::unordered::detail::emplace_args1<int> const&) (unique.hpp:391)
- ==12588== by 0x400DC4: std::pair<boost::unordered::iterator_detail::c_iterator<boost::unordered::detail::ptr_node<int>, boost::unordered::detail::ptr_node<int> const*>, bool> boost::unordered::unordered_set<int, boost::hash<int>, std::equal_to<int>, std::allocator<int> >::emplace<int>(int const&) (unordered_set.hpp:279)
- ==12588== by 0x400CFC: boost::unordered::unordered_set<int, boost::hash<int>, std::equal_to<int>, std::allocator<int> >::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)
Advertisement
Add Comment
Please, Sign In to add comment