Bug #74590 Memory leak in unit test CostEstimationTest.MergeManyBuff
Submitted: 27 Oct 2014 11:16 Modified: 31 Oct 2014 16:01
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.7.6 OS:Any
Assigned to: CPU Architecture:Any

[27 Oct 2014 11:16] Olav Sandstå
Description:
When running the unit test CostEstimationTest.MergeManyBuff under valgrind the following memory leak is reported:

==8220== 48 bytes in 1 blocks are definitely lost in loss record 1 of 5
==8220==    at 0x4C285BC: operator new(unsigned long) (vg_replace_malloc.c:298)
==8220==    by 0x4C6044: Fake_Cost_model_server::Fake_Cost_model_server() (fake_costmodel.h:34)
==8220==    by 0x4C60C2: Fake_Cost_model_table::Fake_Cost_model_table() (fake_costmodel.h:49)
==8220==    by 0x4475C4: bounded_queue_unittest::CostEstimationTest_MergeManyBuff_Test::TestBody() (bounded_queue-t.cc:321)
==8220==    by 0x687674: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2090)
==8220==    by 0x682C8D: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2126)
==8220==    by 0x66FA45: testing::Test::Run() (gtest.cc:2162)
==8220==    by 0x67027F: testing::TestInfo::Run() (gtest.cc:2338)
==8220==    by 0x6708B3: testing::TestCase::Run() (gtest.cc:2445)
==8220==    by 0x675C40: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:4237)
==8220==    by 0x6886A5: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2090)
==8220==    by 0x683936: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2126)

How to repeat:
valgrind --leak-check=full ./merge_small_tests-t --gtest_filter='CostEstimation*'
[31 Oct 2014 16:01] Paul Dubois
Noted in 5.7.6 changelog.

An optimizer cost model constructor allocated but did not destroy a
cost constant object, resulting in a memory leak.