Hello,
I’m trying to look for possible memory leaks in my code and I tried to use valgrind, but it gives enormous number of errors and it looks like most of them are due to ROOT libraries.
I compile my code with g++ and link against ROOT libraries with command:
g++ *.cpp -g -ansi -Wall `/home/zablocki/CMS/root/bin/root-config --cflags` `/home/zablocki/CMS/root/bin/root-config --libs`
then I’m running valgrind:
valgrind --tool=memcheck --suppressions=$ROOTSYS/etc/valgrind-root.supp --log-file=log --leak-check=full myexecutable
I wonder what I might do wrong. Here is example of common error:
[code]==6952== 69,828 bytes in 1,587 blocks are possibly lost in loss record 38,505 of 38,514
==6952== at 0x402569A: operator new(unsigned int) (vg_replace_malloc.c:255)
==6952== by 0x492E7DF: std::_Rb_tree<char const*, std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > >, std::_Select1st<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > >, NameMap::G__charptr_less, std::allocator<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > const&) (in /home/zablocki/CMS/root/lib/libCint.so)
==6952== by 0x492EB91: std::_Rb_tree<char const*, std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > >, std::_Select1st<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > >, NameMap::G__charptr_less, std::allocator<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > >, std::pair<char const* const, std::set<int, std::less<int>, std::allocator<int> > > const&) (in /home/zablocki/CMS/root/lib/libCint.so)
==6952== by 0x493D07E: G__search_tagname (in /home/zablocki/CMS/root/lib/libCint.so)
==6952== by 0x493D2D2: G__set_class_autoloading_table (in /home/zablocki/CMS/root/lib/libCint.so)
==6952== by 0x4241A2E: TCint::LoadLibraryMap(char const*) (in /home/zablocki/CMS/root/lib/libCore.so)
==6952== by 0x423E923: TCint::EnableAutoLoading() (in /home/zablocki/CMS/root/lib/libCore.so)
==6952== by 0x415CB7A: TApplication::TApplication(char const*, int*, char**, void*, int) (in /home/zablocki/CMS/root/lib/libCore.so)
==6952== by 0x415CD9A: TApplication::CreateApplication() (in /home/zablocki/CMS/root/lib/libCore.so)
==6952== by 0x57B702C: TCanvas::Init() (in /home/zablocki/CMS/root/lib/libGpad.so)
==6952== by 0x57B7645: TCanvas::Constructor(char const*, char const*, int) (in /home/zablocki/CMS/root/lib/libGpad.so)
==6952== by 0x57B8018: TCanvas::TCanvas(char const*, char const*, int) (in /home/zablocki/CMS/root/lib/libGpad.so)[/code]
Maybe I’m missing to call some destructors? I have no idea.
I would appreciate some help with this topic.