Re: Memory leak or valgrind too touchy ?

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Tue, 7 Jun 2005 13:31:34 +0200 (MEST)


Hi Jerome,

I assume that your executable is linked with some xxxdict.o files containing the object dictionaries.
In this case, the dictionaries contain static objects that will be executed once to force the creation of the dictionary for all referenced classes. By default these objects will not be destroyed, unless you request this explictly.

Rene Brun

On Tue,
7 Jun
2005, Jerome Glisse wrote:

> Hi
>
> I am wondering if there is a memory leak in libCint & libCore
> as compiling an empty program :
>
> int main(int argc, char *argv[])
> {
> }
>
> linked with root-config --libs (tested with v4.00.0 & 4.04.2) give
> me the report below (lastest stable valgrind). Does this leaks
> are due to miss behavior or interpretation of valgrind or is there
> true memory link in related root lib ?
>
> Thx for you comment on this.
>
> Jerome Glisse
>
> [lpnp78] /home/glisse/dev/new_cell/bin > valgrind --leak-check=yes celld
> ==17490== Memcheck, a memory error detector for x86-linux.
> ==17490== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
> ==17490== Using valgrind-2.4.0, a program supervision framework for x86-linux.
> ==17490== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
> ==17490== For more details, rerun with: -v
> ==17490==
> ==17490==
> ==17490== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 63 from 1)
> ==17490== malloc/free: in use at exit: 7921301 bytes in 12423 blocks.
> ==17490== malloc/free: 26813 allocs, 14390 frees, 15268637 bytes allocated.
> ==17490== For counts of detected errors, rerun with: -v
> ==17490== searching for pointers to 12423 not-freed blocks.
> ==17490== checked 9774060 bytes.
> ==17490==
> ==17490== 26 bytes in 10 blocks are definitely lost in loss record 12 of 58
> ==17490== at 0x1B90354C: malloc (vg_replace_malloc.c:130)
> ==17490== by 0x1BFA02C3: G__memfunc_para_setup (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BFA0092: G__parse_parameter_link (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BF9FD4E: G__memfunc_setup (in
> /usr/local/root/lib/libCint.so)==17490== by 0x1C972676:
> G__cpp_setup_func6() (in /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972788: G__cpp_setup_funcG__Physics (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972BEF: G__cpp_setupG__Physics (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1BF88217: G__call_setup_funcs (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1C9789C6:
> G__cpp_setup_initG__Physics::G__cpp_setup_initG__Physics() (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972D44:
> __static_initialization_and_destruction_0(int, int) (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972EF6:
> _GLOBAL__I__ZN4ROOT20GenerateInitInstanceEPK15TFeldmanCousins (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C978E6C: (within /usr/local/root/lib/libPhysics.so)
> ==17490==
> ==17490==
> ==17490== 102 bytes in 10 blocks are definitely lost in loss record 23 of 58
> ==17490== at 0x1B90354C: malloc (vg_replace_malloc.c:130)
> ==17490== by 0x1BF78B31: G__savestring (in /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BF9FB15: G__memfunc_setup (in
> /usr/local/root/lib/libCint.so)==17490== by 0x1C972598:
> G__cpp_setup_func6() (in /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972788: G__cpp_setup_funcG__Physics (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972BEF: G__cpp_setupG__Physics (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1BF88217: G__call_setup_funcs (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1C9789C6:
> G__cpp_setup_initG__Physics::G__cpp_setup_initG__Physics() (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972D44:
> __static_initialization_and_destruction_0(int, int) (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972EF6:
> _GLOBAL__I__ZN4ROOT20GenerateInitInstanceEPK15TFeldmanCousins (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C978E6C: (within /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C94A9BC: (within /usr/local/root/lib/libPhysics.so)
> ==17490==
> ==17490==
> ==17490== 192 bytes in 1 blocks are possibly lost in loss record 27 of 58
> ==17490== at 0x1B9036BE: operator new(unsigned) (vg_replace_malloc.c:132)
> ==17490== by 0x1BA44825: TStorage::ObjectAlloc(unsigned) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB94A95: TObject::operator new(unsigned) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB9A6AE:
> ROOT::TQObjectInitBehavior::CreateClass(char const*, short,
> std::type_info const&, TClass* (*)(void const*), void (*)(void*,
> TMemberInspector&, char*), char const*, char const*, int, int) const
> (in /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA948FC: ROOT::TGenericClassInfo::GetClass() (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB9F772: TQObject::Class() (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA37F97: TQObject::IsA() const (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA34723: TQObject::GetListOfClassSignals() const
> (in /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA34D50: TQObject::Emit(char const*) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA3405F: TQObject::~TQObject() (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA5A060: TSysEvtHandler::~TSysEvtHandler() (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA59EFA: __tcf_0 (in /usr/local/root/lib/libCore.so)
> ==17490==
> ==17490==
> ==17490== 695 bytes in 1 blocks are definitely lost in loss record 29 of 58
> ==17490== at 0x1B90354C: malloc (vg_replace_malloc.c:130)
> ==17490== by 0x1BFC875B: G__store_dictposition (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BF8D0EB: G__loadfile_tmpfile (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BF4A9DA: G__load_text (in /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BA37D12: TQObject::LoadRQ_OBJECT() (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA3E141: TROOT::TROOT(char const*, char const*,
> void (**)()) (in /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA3AFE1: ROOT::GetROOT() (in /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA59992: TTimer::Reset() (in /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA59326: TTimer::TTimer(long, bool) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA59D15:
> __static_initialization_and_destruction_0(int, int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA59F17: _GLOBAL__I_gSingleShotCleaner (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BD53220: (within /usr/local/root/lib/libCore.so)
> ==17490==
> ==17490==
> ==17490== 8568 bytes in 1 blocks are possibly lost in loss record 45 of 58
> ==17490== at 0x1B90354C: malloc (vg_replace_malloc.c:130)
> ==17490== by 0x1BFA0365: G__memfunc_next (in /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BF9FDC7: G__memfunc_setup (in
> /usr/local/root/lib/libCint.so)==17490== by 0x1BB91BE7:
> G__cpp_setup_func2() (in /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB926D0: G__cpp_setup_funcG__Base1 (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB93D1F: G__cpp_setupG__Base1 (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BF88217: G__call_setup_funcs (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BB9A23A:
> G__cpp_setup_initG__Base1::G__cpp_setup_initG__Base1() (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB9428A:
> __static_initialization_and_destruction_0(int, int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BB94928:
> _GLOBAL__I__ZN4ROOT20GenerateInitInstanceEPK7TBuffer (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BD53220: (within /usr/local/root/lib/libCore.so)
> ==17490== by 0x1B9D4A94: (within /usr/local/root/lib/libCore.so)
> ==17490==
> ==17490==
> ==17490== 47592 bytes in 1422 blocks are possibly lost in loss record 51 of 58
> ==17490== at 0x1B9038F6: operator new[](unsigned) (vg_replace_malloc.c:138)
> ==17490== by 0x1BA44CF6: TStringRef::GetRep(int, int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA4515C: TString::TString(char const*) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA6F950: TClassTable::Add(char const*, short,
> std::type_info const&, void (*)(), int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA70246: ROOT::AddClass(char const*, short,
> std::type_info const&, void (*)(), int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA94E2A: ROOT::TDefaultInitBehavior::Register(char
> const*, short, std::type_info const&, void (*)(), int) const (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA9478C: ROOT::TGenericClassInfo::Init(int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1BA94748:
> ROOT::TGenericClassInfo::TGenericClassInfo(char const*, int, char
> const*, int, std::type_info const&, ROOT::TInitBehavior const*, void
> (*)(), TClass* (*)(void const*), int, int) (in
> /usr/local/root/lib/libCore.so)
> ==17490== by 0x1C956F45: ROOT::GenerateInitInstance(TFeldmanCousins
> const*) (in /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972C2F:
> __static_initialization_and_destruction_0(int, int) (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C972EF6:
> _GLOBAL__I__ZN4ROOT20GenerateInitInstanceEPK15TFeldmanCousins (in
> /usr/local/root/lib/libPhysics.so)
> ==17490== by 0x1C978E6C: (within /usr/local/root/lib/libPhysics.so)
> ==17490==
> ==17490==
> ==17490== 263482 (8568 direct, 254914 indirect) bytes in 1 blocks are
> definitely lost in loss record 52 of 58
> ==17490== at 0x1B90354C: malloc (vg_replace_malloc.c:130)
> ==17490== by 0x1BFA0365: G__memfunc_next (in /usr/local/root/lib/libCint.so)
> ==17490== by 0x1BF9FDC7: G__memfunc_setup (in
> /usr/local/root/lib/libCint.so)==17490== by 0x1C8D9A13:
> G__cpp_setup_func5() (in /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1C8DBF79: G__cpp_setup_funcG__Matrix (in
> /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1C8DD3CB: G__cpp_setupG__Matrix (in
> /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1BF88217: G__call_setup_funcs (in
> /usr/local/root/lib/libCint.so)
> ==17490== by 0x1C8E6950:
> G__cpp_setup_initG__Matrix::G__cpp_setup_initG__Matrix() (in
> /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1C8DDBC4:
> __static_initialization_and_destruction_0(int, int) (in
> /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1C8DE5AA:
> _GLOBAL__I__ZN4ROOT20GenerateInitInstanceEPK12TMatrixFBase (in
> /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1C8E74D4: (within /usr/local/root/lib/libMatrix.so)
> ==17490== by 0x1C7E891C: (within /usr/local/root/lib/libMatrix.so)
> ==17490==
> ==17490== LEAK SUMMARY:
> ==17490== definitely lost: 9391 bytes in 22 blocks.
> ==17490== indirectly lost: 254914 bytes in 1009 blocks.
> ==17490== possibly lost: 56352 bytes in 1424 blocks.
> ==17490== still reachable: 7600644 bytes in 9968 blocks.
> ==17490== suppressed: 0 bytes in 0 blocks.
> ==17490== Reachable blocks (those to which a pointer was found) are not shown.
> ==17490== To see them, rerun with: --show-reachable=yes
>
Received on Tue Jun 07 2005 - 13:31:41 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET