Hello
I’m seeing something i don"t really understand: iwth 5.34.32, when i do a Ttree::Draw to produce TEventList, i got a mem leak when doing a valgrind check, for a new(long) done in TStorage…
I’ve able to get it with a dummy example as follow :
#include "TTree.h"
#include <iostream>
using namespace std;
int main(void)
{
TTree *tt = new TTree("tt","");
double pouet;
tt->Branch("pouet",&pouet,"pouet/D");
for(unsigned int i=0; i<100; i++)
{
pouet=i;
tt->Fill();
}
int nbEnt = tt->Draw(">>evList","","goff");
cout<<"NoSelection :: "<<nbEnt<<endl;
int nbEnt2 = tt->Draw(">>evList","pouet>50","goff");
cout<<"greater than 50 :: "<<nbEnt2<<endl;
int nbEnt3 = tt->Draw(">>evList","","goff");
cout<<"NoSelection :: "<<nbEnt3<<endl;
delete tt;
}
which i compile with
Here is the result of valgrind --suppressions=${ROOTSYS}/etc/valgrind-root.supp --leak-check=full ./pouet
==15349== 29 bytes in 1 blocks are possibly lost in loss record 11,903 of 26,274
==15349== at 0x4A07117: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15349== by 0x35038CF258: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.21)
==15349== by 0x35038CF376: ??? (in /usr/lib64/libstdc++.so.6.0.21)
==15349== by 0x35038D10F5: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.21)
==15349== by 0x5279131: TClassRef::TClassRef(char const*) (in /export/home/jb232551/root_v5.34.32/lib/libCore.so.5.34)
==15349== by 0x92C8DBB: TTreePlayer::TTreePlayer() (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92F5BD4: ROOTDict::new_TTreePlayer(void*) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x5292E57: TClass::New(TClass::ENewType) const (in /export/home/jb232551/root_v5.34.32/lib/libCore.so.5.34)
==15349== by 0x4CA0EEF: TVirtualTreePlayer::TreePlayer(TTree*) (in /export/home/jb232551/root_v5.34.32/lib/libTree.so.5.34)
==15349== by 0x4CC7688: TTree::GetPlayer() (in /export/home/jb232551/root_v5.34.32/lib/libTree.so.5.34)
==15349== by 0x4CC7784: TTree::Draw(char const*, char const*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTree.so.5.34)
==15349== by 0x400D10: main (Memory.C:19)
==15349==
==15349== 34 bytes in 1 blocks are possibly lost in loss record 13,947 of 26,274
==15349== at 0x4A07117: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15349== by 0x35038CF258: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.21)
==15349== by 0x35038CF376: ??? (in /usr/lib64/libstdc++.so.6.0.21)
==15349== by 0x35038D10F5: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.21)
==15349== by 0x5AB2B87: G__add_setup_func (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x5A1772B: G__pragma (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x5A7CC59: G__exec_statement (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x59C428D: G__loadfile (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x59C4A19: G__include_file (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x5A81E9C: G__exec_statement (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x5B0A62A: G__define_struct (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349== by 0x5A81A83: G__exec_statement (in /export/home/jb232551/root_v5.34.32/lib/libCint.so.5.34)
==15349==
==15349== 360 (232 direct, 128 indirect) bytes in 1 blocks are definitely lost in loss record 26,124 of 26,274
==15349== at 0x4A07117: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15349== by 0x52465B8: TStorage::ObjectAlloc(unsigned long) (in /export/home/jb232551/root_v5.34.32/lib/libCore.so.5.34)
==15349== by 0x92EAD4B: TSelectorDraw::CompileVariables(char const*, char const*) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92E6CDE: TSelectorDraw::Begin(TTree*) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92C5645: TTreePlayer::Process(TSelector*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92C7D27: TTreePlayer::DrawSelect(char const*, char const*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x400D10: main (Memory.C:19)
==15349==
==15349== 360 (232 direct, 128 indirect) bytes in 1 blocks are definitely lost in loss record 26,125 of 26,274
==15349== at 0x4A07117: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15349== by 0x52465B8: TStorage::ObjectAlloc(unsigned long) (in /export/home/jb232551/root_v5.34.32/lib/libCore.so.5.34)
==15349== by 0x92EAD4B: TSelectorDraw::CompileVariables(char const*, char const*) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92E6CDE: TSelectorDraw::Begin(TTree*) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92C5645: TTreePlayer::Process(TSelector*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92C7D27: TTreePlayer::DrawSelect(char const*, char const*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x400DD0: main (Memory.C:23)
==15349==
==15349== 8,096 (96 direct, 8,000 indirect) bytes in 1 blocks are definitely lost in loss record 26,246 of 26,274
==15349== at 0x4A07117: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15349== by 0x52465B8: TStorage::ObjectAlloc(unsigned long) (in /export/home/jb232551/root_v5.34.32/lib/libCore.so.5.34)
==15349== by 0x92E7A4B: TSelectorDraw::Begin(TTree*) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92C5645: TTreePlayer::Process(TSelector*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x92C7D27: TTreePlayer::DrawSelect(char const*, char const*, char const*, long long, long long) (in /export/home/jb232551/root_v5.34.32/lib/libTreePlayer.so.5.34)
==15349== by 0x400D10: main (Memory.C:19)
==15349==
==15349== LEAK SUMMARY:
==15349== definitely lost: 560 bytes in 3 blocks
==15349== indirectly lost: 8,256 bytes in 3 blocks
==15349== possibly lost: 63 bytes in 2 blocks
==15349== still reachable: 4,102,777 bytes in 52,764 blocks
==15349== suppressed: 1,268,166 bytes in 9,511 blocks
==15349== Reachable blocks (those to which a pointer was found) are not shown.
==15349== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==15349==
==15349== For counts of detected and suppressed errors, rerun with: -v
==15349== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 1004 from 63)
Is this known ? Should it be added to the valgrind suppressions list or, more likely i guess, am I doing something stupid ?
thanks in advance
jbb