Skip to content

用 valgrind 检查发现内存泄漏-TC_Thread::start() #296

@duansumin2022

Description

@duansumin2022

TARS_VERSION: 3.0.1
client端valgrind 检查发现内存泄漏,valgrin报告:

==95540==
==95540== HEAP SUMMARY:
==95540== in use at exit: 944 bytes in 4 blocks
==95540== total heap usage: 97,080 allocs, 97,076 frees, 21,879,065 bytes allocated
==95540==
==95540== 592 bytes in 1 blocks are possibly lost in loss record 4 of 4
==95540== at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==95540== by 0x40126C4: allocate_dtv (dl-tls.c:317)
==95540== by 0x40126C4: _dl_allocate_tls (dl-tls.c:533)
==95540== by 0x674A7AB: allocate_stack (allocatestack.c:539)
==95540== by 0x674A7AB: pthread_create@@GLIBC_2.2.5 (pthread_create.c:447)
==95540== by 0x5C0A596: __gthread_create (gthr-default.h:662)
==95540== by 0x5C0A596: std::thread::_M_start_thread(std::shared_ptrstd::thread::_Impl_base) (thread.cc:142)
==95540== by 0x552E6B1: std::thread::thread<void ()(tars::TC_Thread), tars::TC_Thread* const>(void (&&)(tars::TC_Thread), tars::TC_Thread* const&&) (thread:135)
==95540== by 0x552D83C: tars::TC_Thread::start() (tc_thread.cpp:145)
==95540== by 0x553736D: tars::TC_TimeProvider::getInstance()::{lambda()#1}::operator()() const (tc_timeprovider.cpp:32)
==95540== by 0x5537B7F: void std::_Bind_simple<tars::TC_TimeProvider::getInstance()::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>) (functional:1732)
==95540== by 0x5537B20: std::_Bind_simple<tars::TC_TimeProvider::getInstance()::{lambda()#1} ()>::operator()() (functional:1720)
==95540== by 0x5537A4A: void std::__once_call_impl<std::_Bind_simple<tars::TC_TimeProvider::getInstance()::{lambda()#1} ()> >() (mutex:754)
==95540== by 0x674EE3F: pthread_once (pthread_once.S:103)
==95540== by 0x5537324: __gthread_once(int*, void (*)()) (gthr-default.h:699)
==95540==
==95540== LEAK SUMMARY:
==95540== definitely lost: 0 bytes in 0 blocks
==95540== indirectly lost: 0 bytes in 0 blocks
==95540== possibly lost: 592 bytes in 1 blocks
==95540== still reachable: 352 bytes in 3 blocks
==95540== suppressed: 0 bytes in 0 blocks
==95540== Reachable blocks (those to which a pointer was found) are not shown.
==95540== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==95540==
==95540== For lists of detected and suppressed errors, rerun with: -s
==95540== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions