{
// name this ROOT macro file "RunMe.cxx" and then debug everything using:
// valgrind --tool=memcheck --leak-check=full --suppressions=`root-config --etcdir`/valgrind-root.supp `root-config --bindir`/root.exe -b -n -q -l RunMe.cxx
// valgrind --tool=exp-sgcheck --suppressions=`root-config --etcdir`/valgrind-root.supp `root-config --bindir`/root.exe -b -n -q -l RunMe.cxx
// note: study valgrind's output messages from running the "Mainmodule"
gROOT->LoadMacro("ParticleType.cxx++g");
gROOT->LoadMacro("ResonanceType.cxx++g");
gROOT->LoadMacro("Particle.cxx++g");
gROOT->LoadMacro("Mainmodule.cxx++g");
std::cout << " ... starting Mainmodule() ..." << std::endl;
gROOT->ProcessLine("Mainmodule();");
std::cout << " ... finished Mainmodule() ..." << std::endl;
}
Particle.h (984 Bytes)
Particle.cxx (4.3 KB)
Particelle.root (8.6 KB)
I think, the main problem, as reported by the AddressSanitizer, is in the “Mainmodule.cxx”, where you define Particle particella [110];
but then you access particella[100+n+1]
without any check that n<=8
. The simplest “brutal fix” could be to define Particle particella [(100 + (100 * 2))];
.
BTW. In the “Mainmodule.cxx”, better use delete file;
, instead of file->Close();
.