Guest User

Boost.Unordered vs. Valgrind - possibly lost

a guest
Jul 4th, 2014
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. $ cat test.cpp
  2. #include <set>
  3. #include <boost/unordered_set.hpp>
  4.  
  5. #if 0
  6. typedef std::set<int> Set;
  7. #else
  8. typedef boost::unordered_set<int> Set;
  9. #endif
  10.  
  11. Set* set = NULL;
  12.  
  13. int main() {
  14. set = new Set();
  15. set->insert(1);
  16. // delete set;
  17. }
  18.  
  19. ----------------------------------------------------------
  20.  
  21. $ valgrind --leak-check=full ./a.out
  22. ==12588== Memcheck, a memory error detector
  23. ==12588== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  24. ==12588== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
  25. ==12588== Command: ./a.out
  26. ==12588==
  27. ==12588==
  28. ==12588== HEAP SUMMARY:
  29. ==12588== in use at exit: 208 bytes in 3 blocks
  30. ==12588== total heap usage: 3 allocs, 0 frees, 208 bytes allocated
  31. ==12588==
  32. ==12588== 24 bytes in 1 blocks are possibly lost in loss record 1 of 3
  33. ==12588== at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  34. ==12588== by 0x40296C: __gnu_cxx::new_allocator<boost::unordered::detail::ptr_node<int> >::allocate(unsigned long, void const*) (new_allocator.h:104)
  35. ==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)
  36. ==12588== by 0x401E79: boost::unordered::detail::node_constructor<std::allocator<boost::unordered::detail::ptr_node<int> > >::construct() (buckets.hpp:419)
  37. ==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)
  38. ==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)
  39. ==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)
  40. ==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)
  41. ==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)
  42. ==12588== by 0x400A96: main (test.cpp:14)
  43. ==12588==
  44. ==12588== LEAK SUMMARY:
  45. ==12588== definitely lost: 0 bytes in 0 blocks
  46. ==12588== indirectly lost: 0 bytes in 0 blocks
  47. ==12588== possibly lost: 24 bytes in 1 blocks
  48. ==12588== still reachable: 184 bytes in 2 blocks
  49. ==12588== suppressed: 0 bytes in 0 blocks
  50. ==12588== Reachable blocks (those to which a pointer was found) are not shown.
  51. ==12588== To see them, rerun with: --leak-check=full --show-leak-kinds=all
  52. ==12588==
  53. ==12588== For counts of detected and suppressed errors, rerun with: -v
  54. ==12588== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Advertisement
Add Comment
Please, Sign In to add comment