mardi 19 juin 2018

std::make_shared

Valgrind gives me some memory leaks when I use std::make_shared:

TEST_F(CTestChild, add_gran_child) {
    auto child{ std::make_shared<CChild>(TType::Home, std::make_shared<CMockParent>()) };
    NiceMock<CMockCaller> caller;
    auto gran_child( std::make_shared<CMockGranChild>(TType::Girl, child, caller) );
    child->Add(gran_child);
    EXPECT_EQ(child->GetCount(), 1);
}

Why is make_shared giving me a memory leak?

Aucun commentaire:

Enregistrer un commentaire