Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-3253

Unit test memory leak when compiling with clang (but not with gcc)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Auto Closed
    • 0.11
    • None
    • C++ Broker, C++ Client
    • compiling with clang 2.9

    Description

      When running "make check" on the qpid c++ tree with the clang compiler valgrind reports memory leaks in the unit_test program run, but all other tests pass:

      Output of valrind is:
      Valgrind error log in unit_test.vglog.
      ==21498== Memcheck, a memory error detector
      ==21498== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
      ==21498== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
      ==21498== Command: /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test
      ==21498== Parent PID: 21484
      ==21498==
      ==21498==
      ==21498== HEAP SUMMARY:
      ==21498== in use at exit: 1,958 bytes in 24 blocks
      ==21498== total heap usage: 491,407 allocs, 491,383 frees, 133,537,995 bytes allocated
      ==21498==
      ==21498== 24 bytes in 1 blocks are definitely lost in loss record 6 of 21
      ==21498== at 0x4A059DC: operator new(unsigned long) (vg_replace_malloc.c:220)
      ==21498== by 0x631DC57: qpid::types::VariantImpl::create(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x631F2BF: qpid::types::Variant::operator=(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x5925068: qmf::Expression::Expression(std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> > const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D8B: qmf::QueryImpl::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D3B: qmf::Query::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5E424A: qpid::tests::Qmf2Suite::testQueryPredicateErrors::test_method() (in /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test)
      ==21498== by 0x4CC1540: boost::unit_test::ut_detail::callback0_impl_t<int, boost::unit_test::(anonymous namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused> > >::invoke() (callback.hpp:118)
      ==21498== by 0x4CA383D: boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (callback.hpp:118)
      ==21498== by 0x4CA42DA: boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (execution_monitor.ipp:1211)
      ==21498== by 0x4CC162D: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (unit_test_monitor.ipp:69)
      ==21498== by 0x4CAB330: boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (framework.ipp:156)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CA543F: boost::unit_test::framework::run(unsigned long, bool) (framework.ipp:442)
      ==21498== by 0x4CBF726: boost::unit_test::unit_test_main(bool (), int, char**) (unit_test_main.ipp:185)
      ==21498== by 0x37D4C1EE5C: (below main) (libc-start.c:226)
      ==21498==
      ==21498== 62 (24 direct, 38 indirect) bytes in 1 blocks are definitely lost in loss record 13 of 21
      ==21498== at 0x4A059DC: operator new(unsigned long) (vg_replace_malloc.c:220)
      ==21498== by 0x631DD0F: qpid::types::VariantImpl::create(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x631F2BF: qpid::types::Variant::operator=(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x5924F7A: qmf::Expression::Expression(std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> > const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D8B: qmf::QueryImpl::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D3B: qmf::Query::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5E424A: qpid::tests::Qmf2Suite::testQueryPredicateErrors::test_method() (in /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test)
      ==21498== by 0x4CC1540: boost::unit_test::ut_detail::callback0_impl_t<int, boost::unit_test::(anonymous namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused> > >::invoke() (callback.hpp:118)
      ==21498== by 0x4CA383D: boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (callback.hpp:118)
      ==21498== by 0x4CA42DA: boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (execution_monitor.ipp:1211)
      ==21498== by 0x4CC162D: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (unit_test_monitor.ipp:69)
      ==21498== by 0x4CAB330: boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (framework.ipp:156)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CA543F: boost::unit_test::framework::run(unsigned long, bool) (framework.ipp:442)
      ==21498== by 0x4CBF726: boost::unit_test::unit_test_main(bool (), int, char**) (unit_test_main.ipp:185)
      ==21498== by 0x37D4C1EE5C: (below main) (libc-start.c:226)
      ==21498==
      ==21498== 62 (24 direct, 38 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 21
      ==21498== at 0x4A059DC: operator new(unsigned long) (vg_replace_malloc.c:220)
      ==21498== by 0x631DD0F: qpid::types::VariantImpl::create(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x631F2BF: qpid::types::Variant::operator=(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x5924F7A: qmf::Expression::Expression(std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> > const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D8B: qmf::QueryImpl::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D3B: qmf::Query::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5E45B9: qpid::tests::Qmf2Suite::testQueryPredicateErrors::test_method() (in /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test)
      ==21498== by 0x4CC1540: boost::unit_test::ut_detail::callback0_impl_t<int, boost::unit_test::(anonymous namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused> > >::invoke() (callback.hpp:118)
      ==21498== by 0x4CA383D: boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (callback.hpp:118)
      ==21498== by 0x4CA42DA: boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (execution_monitor.ipp:1211)
      ==21498== by 0x4CC162D: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (unit_test_monitor.ipp:69)
      ==21498== by 0x4CAB330: boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (framework.ipp:156)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CA543F: boost::unit_test::framework::run(unsigned long, bool) (framework.ipp:442)
      ==21498== by 0x4CBF726: boost::unit_test::unit_test_main(bool (), int, char**) (unit_test_main.ipp:185)
      ==21498== by 0x37D4C1EE5C: (below main) (libc-start.c:226)
      ==21498==
      ==21498== 62 (24 direct, 38 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 21
      ==21498== at 0x4A059DC: operator new(unsigned long) (vg_replace_malloc.c:220)
      ==21498== by 0x631DD0F: qpid::types::VariantImpl::create(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x631F2BF: qpid::types::Variant::operator=(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x5924F7A: qmf::Expression::Expression(std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> > const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D8B: qmf::QueryImpl::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D3B: qmf::Query::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5E4928: qpid::tests::Qmf2Suite::testQueryPredicateErrors::test_method() (in /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test)
      ==21498== by 0x4CC1540: boost::unit_test::ut_detail::callback0_impl_t<int, boost::unit_test::(anonymous namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused> > >::invoke() (callback.hpp:118)
      ==21498== by 0x4CA383D: boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (callback.hpp:118)
      ==21498== by 0x4CA42DA: boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (execution_monitor.ipp:1211)
      ==21498== by 0x4CC162D: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (unit_test_monitor.ipp:69)
      ==21498== by 0x4CAB330: boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (framework.ipp:156)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CA543F: boost::unit_test::framework::run(unsigned long, bool) (framework.ipp:442)
      ==21498== by 0x4CBF726: boost::unit_test::unit_test_main(bool (), int, char**) (unit_test_main.ipp:185)
      ==21498== by 0x37D4C1EE5C: (below main) (libc-start.c:226)
      ==21498==
      ==21498== 62 (24 direct, 38 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 21
      ==21498== at 0x4A059DC: operator new(unsigned long) (vg_replace_malloc.c:220)
      ==21498== by 0x631DD0F: qpid::types::VariantImpl::create(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x631F2BF: qpid::types::Variant::operator=(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x5924F7A: qmf::Expression::Expression(std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> > const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D8B: qmf::QueryImpl::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D3B: qmf::Query::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5E3B69: qpid::tests::Qmf2Suite::testQueryPredicateErrors::test_method() (in /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test)
      ==21498== by 0x4CC1540: boost::unit_test::ut_detail::callback0_impl_t<int, boost::unit_test::(anonymous namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused> > >::invoke() (callback.hpp:118)
      ==21498== by 0x4CA383D: boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (callback.hpp:118)
      ==21498== by 0x4CA42DA: boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (execution_monitor.ipp:1211)
      ==21498== by 0x4CC162D: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (unit_test_monitor.ipp:69)
      ==21498== by 0x4CAB330: boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (framework.ipp:156)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CA543F: boost::unit_test::framework::run(unsigned long, bool) (framework.ipp:442)
      ==21498== by 0x4CBF726: boost::unit_test::unit_test_main(bool (), int, char**) (unit_test_main.ipp:185)
      ==21498== by 0x37D4C1EE5C: (below main) (libc-start.c:226)
      ==21498==
      ==21498== 125 (48 direct, 77 indirect) bytes in 2 blocks are definitely lost in loss record 19 of 21
      ==21498== at 0x4A059DC: operator new(unsigned long) (vg_replace_malloc.c:220)
      ==21498== by 0x631DD0F: qpid::types::VariantImpl::create(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x631F2BF: qpid::types::Variant::operator=(qpid::types::Variant const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqpidtypes.so.1.0.0)
      ==21498== by 0x5924F7A: qmf::Expression::Expression(std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> > const&) (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D8B: qmf::QueryImpl::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5926D3B: qmf::Query::matchesPredicate(std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > > const&) const (in /home/andrew/Work/qpid/bld-clang/src/.libs/libqmf2.so.1.0.0)
      ==21498== by 0x5E4C97: qpid::tests::Qmf2Suite::testQueryPredicateErrors::test_method() (in /home/andrew/Work/qpid/bld-clang/src/tests/.libs/lt-unit_test)
      ==21498== by 0x4CC1540: boost::unit_test::ut_detail::callback0_impl_t<int, boost::unit_test::(anonymous namespace)::zero_return_wrapper_t<boost::unit_test::callback0<boost::unit_test::ut_detail::unused> > >::invoke() (callback.hpp:118)
      ==21498== by 0x4CA383D: boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (callback.hpp:118)
      ==21498== by 0x4CA42DA: boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (execution_monitor.ipp:1211)
      ==21498== by 0x4CC162D: boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (unit_test_monitor.ipp:69)
      ==21498== by 0x4CAB330: boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (framework.ipp:156)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CE0AEA: boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (unit_test_suite.ipp:207)
      ==21498== by 0x4CA543F: boost::unit_test::framework::run(unsigned long, bool) (framework.ipp:442)
      ==21498== by 0x4CBF726: boost::unit_test::unit_test_main(bool (), int, char**) (unit_test_main.ipp:185)
      ==21498== by 0x37D4C1EE5C: (below main) (libc-start.c:226)
      ==21498==
      ==21498== LEAK SUMMARY:
      ==21498== definitely lost: 168 bytes in 7 blocks
      ==21498== indirectly lost: 229 bytes in 12 blocks
      ==21498== possibly lost: 0 bytes in 0 blocks
      ==21498== still reachable: 1,561 bytes in 5 blocks
      ==21498== suppressed: 0 bytes in 0 blocks
      ==21498== Reachable blocks (those to which a pointer was found) are not shown.
      ==21498== To see them, rerun with: --leak-check=full --show-reachable=yes
      ==21498==
      ==21498== For counts of detected and suppressed errors, rerun with: -v
      ==21498== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 30 from 8)
      Valgrind reported errors in unit_test.vglog; see above.
      FAIL: unit_test

      Attachments

        Activity

          People

            Unassigned Unassigned
            astitcher Andrew Stitcher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: