Google mock with boost :: test causes memory leak

I am trying to create unit tests using boost :: test and google mock. Adding a call to InitGoogleMock causes an increase in the memory leak signal. I searched for some kind of "DeInitGoogleMock" but did not find it.

Why is there a memory leak? How can this be fixed?

main.cpp:

#include <gmock/gmock.h> #define BOOST_TEST_MODULE my_testt #include <boost/test/unit_test.hpp> struct InitGMock { InitGMock() { ::testing::GTEST_FLAG(throw_on_failure) = true; //::testing::InitGoogleMock(&boost::unit_test::framework::master_test_suite().argc, // boost::unit_test::framework::master_test_suite().argv); } ~InitGMock() { } }; BOOST_GLOBAL_FIXTURE(InitGMock); BOOST_AUTO_TEST_CASE( test_case ) { BOOST_CHECK( true ); } 

Conclusion:

 Running 1 test case... *** No errors detected 

The result after breaking the lines of InitGoogleMock:

 Running 1 test case... *** No errors detected Detected memory leaks! Dumping objects -> {669} normal block at 0x00B4E700, 48 bytes long. Data: < > 00 E7 B4 00 00 E7 B4 00 00 E7 B4 00 CD CD CD CD {668} normal block at 0x00B473B0, 28 bytes long. Data: < > 00 00 00 00 CD CD CD CD CD CD CD CD CD CD CD CD {667} normal block at 0x00B471B8, 24 bytes long. Data: < > FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 Object dump complete. 
0
source share

Source: https://habr.com/ru/post/893144/


All Articles