[Boost-bugs] [Boost C++ Libraries] #5582: There is a memory leak in the BOOST_AUTO_TEST_CASE_TEMPLATE

Subject: [Boost-bugs] [Boost C++ Libraries] #5582: There is a memory leak in the BOOST_AUTO_TEST_CASE_TEMPLATE
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-30 15:07:51


#5582: There is a memory leak in the BOOST_AUTO_TEST_CASE_TEMPLATE
-----------------------------------------------------+----------------------
 Reporter: Anton Matosov <anton.matosov@…> | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: Boost 1.47.0 | Component: test
  Version: Boost 1.46.1 | Severity: Problem
 Keywords: test unit_test memory leak |
-----------------------------------------------------+----------------------
 There is memory leak in the
 boost::unit_test::ut_detail::generate_test_case_4_type::operator() which
 is used by boost::unit_test::ut_detail::template_test_case_gen
 which in its turn is used by BOOST_AUTO_TEST_CASE_TEMPLATE

 The problematic code is provided below. The test_case created here never
 gets deleted.
 {{{
 template<typename TestType>
 void operator()( mpl::identity<TestType> )
 {
   ...
   m_holder.m_test_cases.push_back(
      new test_case( full_name,
 test_case_template_invoker<TestCaseTemplate,TestType>() ) );
 }
 }}}

 Below is the code that can be used to reproduce the issue:
 {{{
 #define BOOST_TEST_MAIN
 #include <boost/test/auto_unit_test.hpp>
 #include <boost/test/test_tools.hpp>
 #include <boost/test/test_case_template.hpp>
 #include <boost/mpl/list.hpp>

 BOOST_AUTO_TEST_SUITE( TestMemLeak )

 BOOST_AUTO_TEST_CASE_TEMPLATE( TestCase, Type, boost::mpl::list<int> )
 {
 }

 BOOST_AUTO_TEST_SUITE_END()
 }}}

 '''Note:''' This leak is detected only when application is linked with C
 runtime statically.
 Configured test application can be found in the attachment

 Execution output:
 {{{
 Running 1 test case...

 *** No errors detected
 Detected memory leaks!
 Dumping objects ->
 {103} normal block at 0x00808D50, 4 bytes long.
  Data: <int > 69 6E 74 00
 {102} normal block at 0x00808D18, 8 bytes long.
  Data: <P > 50 8D 80 00 00 00 00 00
 Object dump complete.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5582>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC