queue and stack leak
Closed this issue · 2 comments
pm100 commented
neither of these have any destructor code to clean up their memory use.
Eg
pm100@paul-think:~/work/ProAlgos-Cpp/cpp$ valgrind --leak-check=full bin/stack
==23455== Memcheck, a memory error detector
==23455== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==23455== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==23455== Command: bin/stack
==23455==
===============================================================================
All tests passed (24 assertions in 5 test cases)
==23455==
==23455== HEAP SUMMARY:
==23455== in use at exit: 256 bytes in 16 blocks
==23455== total heap usage: 2,630 allocs, 2,614 frees, 425,008 bytes allocated
==23455==
==23455== 96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 16
==23455== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23455== by 0x28AE54: Stack<int>::push(int const&) (stack.hpp:41)
==23455== by 0x2885D8: ____C_A_T_C_H____T_E_S_T____4() (stack.cpp:45)
==23455== by 0x2A3845: Catch::TestInvokerAsFunction::invoke() const (catch.hpp:14261)
==23455== by 0x2A2A6E: Catch::TestCase::invoke() const (catch.hpp:14100)
==23455== by 0x29CD8D: Catch::RunContext::invokeActiveTestCase() (catch.hpp:12959)
==23455== by 0x29CAC0: Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (catch.hpp:12932)
==23455== by 0x29B536: Catch::RunContext::runTest(Catch::TestCase const&) (catch.hpp:12693)
==23455== by 0x29E715: Catch::(anonymous namespace)::TestGroup::execute() (catch.hpp:13287)
==23455== by 0x29FB2E: Catch::Session::runInternal() (catch.hpp:13493)
==23455== by 0x29F824: Catch::Session::run() (catch.hpp:13449)
==23455== by 0x2E022A: int Catch::Session::run<char>(int, char const* const*) (catch.hpp:13171)
==23455==
==23455== 160 (16 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 16
==23455== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23455== by 0x28AE54: Stack<int>::push(int const&) (stack.hpp:41)
==23455== by 0x288053: ____C_A_T_C_H____T_E_S_T____2() (stack.cpp:27)
==23455== by 0x2A3845: Catch::TestInvokerAsFunction::invoke() const (catch.hpp:14261)
==23455== by 0x2A2A6E: Catch::TestCase::invoke() const (catch.hpp:14100)
==23455== by 0x29CD8D: Catch::RunContext::invokeActiveTestCase() (catch.hpp:12959)
==23455== by 0x29CAC0: Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (catch.hpp:12932)
==23455== by 0x29B536: Catch::RunContext::runTest(Catch::TestCase const&) (catch.hpp:12693)
==23455== by 0x29E715: Catch::(anonymous namespace)::TestGroup::execute() (catch.hpp:13287)
==23455== by 0x29FB2E: Catch::Session::runInternal() (catch.hpp:13493)
==23455== by 0x29F824: Catch::Session::run() (catch.hpp:13449)
==23455== by 0x2E022A: int Catch::Session::run<char>(int, char const* const*) (catch.hpp:13171)
==23455==
==23455== LEAK SUMMARY:
==23455== definitely lost: 32 bytes in 2 blocks
==23455== indirectly lost: 224 bytes in 14 blocks
==23455== possibly lost: 0 bytes in 0 blocks
==23455== still reachable: 0 bytes in 0 blocks
==23455== suppressed: 0 bytes in 0 blocks
==23455==
==23455== For lists of detected and suppressed errors, rerun with: -s
==23455== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
also binary_search_tree
stale commented
This issue has been automatically marked as inactive because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.
stale commented
This issue has been automatically marked as inactive because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.