Open mroland91 opened 1 week ago
This might be a duplicated issue to #543 which has been fixed. You can test it with the latest code.
Regards
I'm using 1.3.12 which contains that fix.
Can you give a minimum code snippet that can reproduce the problem? Thanks!
Regards
Describe the bug When I am running tests for my app which uses redis-plus-plus, sometimes valgrind reports memory leak. The trace is the same every time (run into this around 5-8 times).
==6664== Memcheck, a memory error detector
==6664== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==6664== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==6664== Command: /home/test/redis-client
==6664== Parent PID: 6663
==6664==
==6664==
==6664== HEAP SUMMARY:
==6664== in use at exit: 21,237 bytes in 32 blocks
==6664== total heap usage: 61,639 allocs, 61,607 frees, 7,818,347 bytes allocated
==6664==
==6664== 2,224 (400 direct, 1,824 indirect) bytes in 1 blocks are definitely lost in loss record 23 of 24
==6664== at 0x4C398C3: operator new(unsigned long) (vg_replace_malloc.c:422)
==6664== by 0x6CB7522: gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<sw::redis::AsyncConnection, std::allocator, ( gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB6FAA: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<sw::redis::AsyncConnection, std::allocator, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<sw::redis::AsyncConnection, std::allocator, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB6709: std::allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<sw::redis::AsyncConnection, std::allocator, (__gnu_cxx::_Lock_policy)2> > > std:: allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<sw::redis::AsyncConnection, std::allocator, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<sw::redis::AsyncConnection, std::allocator, (__gnu_cxx::_Lock_policy)2> >&) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB61E5: std::shared_count<(__gnu_cxx::_Lock_policy)2>::shared_count<sw::redis::AsyncConnection, std::allocator, sw::redis::ConnectionOptions&, sw::redis::EventLoop>(sw::redis::AsyncConnection&, std::_Sp_alloc_shared_tag<std::allocator >, sw::redis::ConnectionOptions&, sw::redis::EventLoop*&&) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB5B0B: std::shared_ptr<sw::redis::AsyncConnection, (__gnu_cxx::_Lock_policy)2>::shared_ptr<std::allocator, sw::redis::ConnectionOptions&, sw::redis::EventLoop>(std::_Sp_alloc_shared_tag<std::allocator >, sw::redis::ConnectionOptions&, sw::redis::EventLoop &&) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB55B6: std::shared_ptr::shared_ptr<std::allocator, sw::redis::ConnectionOptions&, sw::redis::EventLoop>(std::_Sp_alloc_shared_tag<std::allocator >, sw::redis::ConnectionOptions&, sw::redis::EventLoop &&) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB4CF3: std::shared_ptr std::allocate_shared<sw::redis::AsyncConnection, std::allocator, sw::redis::ConnectionOptions&, sw::redis::EventLoop>(std::allocator const&, sw::redis::ConnectionOptions&, sw::redis::EventLoop &&) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB4567: std::shared_ptr std::make_shared<sw::redis::AsyncConnection, sw::redis::ConnectionOptions&, sw::redis::EventLoop>(sw::redis::ConnectionOptions&, sw::redis::EventLoop&&) (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB3314: sw::redis::AsyncConnectionPool::_create() (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CB24DB: sw::redis::AsyncConnectionPool::fetch() (in /usr/lib64/libredis++.so.1.3.12)
==6664== by 0x6CAF4D1: sw::redis::GuardedAsyncConnection::GuardedAsyncConnection(std::shared_ptr const&) (in /usr/lib64/libredis++.so.1.3.12)
==6664==
==6664== LEAK SUMMARY:
==6664== definitely lost: 400 bytes in 1 blocks
==6664== indirectly lost: 1,824 bytes in 22 blocks
==6664== possibly lost: 384 bytes in 1 blocks
==6664== still reachable: 18,629 bytes in 8 blocks
==6664== suppressed: 0 bytes in 0 blocks
==6664== Reachable blocks (those to which a pointer was found) are not shown.
==6664== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==6664==
==6664== For lists of detected and suppressed errors, rerun with: -s
==6664== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
To Reproduce sporadic
Expected behavior no report from valgrind
Environment: