Hi,
In my custom class that includes a TTree I have:
this->tadc->GetUserInfo()->Add(new TNamed("type", this->type));
this->tadc->GetUserInfo()->Add(new TNamed("comment", this->comment));
this->tadc->GetUserInfo()->Add(new TParameter<int>("creation_datetime", this->creation_datetime));
this->tadc->GetUserInfo()->Add(new TNamed("modification_history", this->modification_history));
this->tadc->GetUserInfo()->Add(new TParameter<int>("source_datetime", this->source_datetime));
this->tadc->GetUserInfo()->Add(new TNamed("modification_software", this->modification_software));
this->tadc->GetUserInfo()->Add(new TNamed("modification_software_version", this->modification_software_version));
this->tadc->GetUserInfo()->Add(new TParameter<int>("analysis_level", this->analysis_level));
where type
, comment
etc. are TStrings, and creation_datetime
etc. are ints, members of the class.
Valgrind reports:
==62976== 16 bytes in 1 blocks are possibly lost in loss record 1,066 of 22,597
==62976== at 0x4840A3A: operator new[](unsigned long) (vg_replace_malloc.c:729)
==62976== by 0x48E68A9: TString::Init(int, int) (in /home/lewhoo/software/root/root/lib/libCore.so)
==62976== by 0x48E6F33: TString::TString(char const*) (in /home/lewhoo/software/root/root/lib/libCore.so)
==62976== by 0x5BE9232: TLeaf::TLeaf(TBranch*, char const*, char const*) (in /home/lewhoo/software/root/root/lib/libTree.so)
==62976== by 0x5BEB23A: TLeafElement::TLeafElement(TBranch*, char const*, int, int) (in /home/lewhoo/software/root/root/lib/libTree.so)
==62976== by 0x5BBECFC: TBranchElement::Init(TTree*, TBranch*, char const*, TVirtualCollectionProxy*, int, int, int) (in /home/lewhoo/software/root/root/lib/libTree.so)
==62976== by 0x5BBF20B: TBranchElement::TBranchElement(TTree*, char const*, TVirtualCollectionProxy*, int, int, int) (in /home/lewhoo/software/root/root/lib/libTree.so)
==62976== by 0x5C1DAE1: TTree::BronchExec(char const*, char const*, void*, bool, int, int) (in /home/lewhoo/software/root/root/lib/libTree.so)
==62976== by 0x420715: TADC::CreateTree() (in /home/lewhoo/GRAND/gtot/cmake-build-release/gtot)
==62976== by 0x423389: TADC::TADC(bool) (in /home/lewhoo/GRAND/gtot/cmake-build-release/gtot)
==62976== by 0x4067BB: main (in /home/lewhoo/GRAND/gtot/cmake-build-release/gtot)
many times, referring to the lines that I pasted above. I know that the blocks are “possibly” lost, and I don’t know which lines exactly are at fault, but it made me wonder: do I use Tnamed/TParameter with GetUserInfo::Add() properly?
Thanks!
ROOT Version: 6.37.01
Platform: Fedora 42