Hello, why I get a memory leak with this code using 6.04/02?
#include <memory>
#include <TFile.h>
#include <TObjArray.h>
int main()
{
TFile f("myfile.root")
std::unique_ptr<TObjArray> formulae(dynamic_cast<TObjArray*>(f.Get("formulae")));
return 0;
}
==10938== 1,600 (768 direct, 832 indirect) bytes in 12 blocks are definitely lost in loss record 13,701 of 14,557
==10938== at 0x4C27965: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10938== by 0xA8B58C8: TStorage::ObjectAlloc(unsigned long) (in /home/turra/root/lib/libCore.so)
==10938== by 0xA832269: ROOT::new_TNamed(void*) (in /home/turra/root/lib/libCore.so)
==10938== by 0xA903C88: TClass::New(TClass::ENewType, bool) const (in /home/turra/root/lib/libCore.so)
==10938== by 0x9666BE9: TBufferFile::ReadObjectAny(TClass const*) (in /home/turra/root/lib/libRIO.so)
==10938== by 0xA8D755F: TObjArray::Streamer(TBuffer&) (in /home/turra/root/lib/libCore.so)
==10938== by 0x961C3A4: TKey::ReadObj() (in /home/turra/root/lib/libRIO.so)
==10938== by 0x9582931: TDirectoryFile::Get(char const*) (in /home/turra/root/lib/libRIO.so)
==10938== by 0x400CF9: main (test_root.cxx:8)
==10938==
you can use one of the file here: atlas.web.cern.ch/Atlas/GROUPS/D … online/v3/