NOVA art. memory leaking Alexey Naumov Lebedev Physical Institute Moscow 1
Leaking? Running $nova –n -500 –c prodgenie.fcl prodgenie.fcl: >> #list the modules for this path, order matters, filters reject all following items >>simulate: [ generator, geantgen, photrans, daq ] Events Memory usage (mb) (3.6GB) ~ 400kb losses per event! 2
How detect source of leaking? - ‘top’ command [ display top CPU processes ] output: - ‘Valgrind’ [ tool for detect memory usage ] output: ==7158== 81,500 (80 direct, 81,420 indirect) bytes in 1 blocks are definitely lost in loss record 57,587 of 57,672 ==7158== at 0x4A07F61: malloc (vg_replace_malloc.c:236) ==7158== by 0x4F79D73: operator new(unsigned long) (in /grid/fermiapp/nova/novaart/externals /art/v0_06_01/slf5.x86_$ ==7158== by 0x2E1C87D9: G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(G4VPreCompoundModel*) (in /grid/$ ==7158== by 0x3A7CE497: G4QGSPProtonBuilder::G4QGSPProtonBuilder(bool, bool) (in /grid/fermiapp/nova/novaart/externals-0.$ ==7158== by 0x3AB4DDD9: HadronPhysicsQGSP_BERT::CreateModels() (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4/v4_$ ==7158== by 0x3AB4E158: HadronPhysicsQGSP_BERT::ConstructProcess() (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4$ ==7158== by 0x3B8083D4: G4VModularPhysicsList::ConstructProcess() (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4/$ ==7158== by 0x3B7F7F7F: G4RunManagerKernel::InitializePhysics() (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4/v4$ ==7158== by 0x3B7F9724: G4RunManager::InitializePhysics() (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4/v4_9_4_p$ ==7158== by 0x3B7F9A8F: G4RunManager::Initialize() (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4/v4_9_4_p01/Linu$ ==7158== by 0x3B7FF79E: G4RunMessenger::SetNewValue(G4UIcommand*, G4String) (in /grid/fermiapp/nova/novaart/externals-0.2$ ==7158== by 0x35F1EBDF: G4UIcommand::DoIt(G4String) (in /grid/fermiapp/nova/novaart/externals-0.2.0/geant4/v4_9_4_p01/Lin$ ==7158== ==7158== 81,500 (80 direct, 81,420 indirect) bytes in 1 blocks are definitely lost in loss record 57,588 of 57,672 ==7158== at 0x4A07F61: malloc (vg_replace_malloc.c:236) ==7158== by 0x4F79D73: operator new(unsigned long) (in /grid/fermiapp/nova/novaart/externals-0.2.0/art/v0_06_01/slf5.x86_$ anaumov m 44m 36m R :00.34 nova st3mag m 184m 79m S :04.38 nova xbhuang m 166m 77m S :10.98 nova anaumov m 86m 64m R :01.59 nova st3mag m 184m 79m S :04.45 nova xbhuang m 166m 77m S :10.98 nova anaumov m 119m 66m S :02.20 nova xbhuang m 166m 77m S :10.98 nova st3mag m 184m 79m S :04.45 nova xbhuang m 166m 77m S :10.98 nova 3
Memory usage during generation by ‘top’ command prodgenie.fcl (line 48): >> #list the modules for this path, order matters, filters reject all following items >>simulate: [ generator, geantgen, photrans, daq ] 4
Valgrind output output: ==7158== 171,304 bytes in 2,343 blocks are possibly lost in loss record 57,660 of 57,672 ==7158== at 0x4A07F61: malloc (vg_replace_malloc.c:236) ==7158== by 0x4F79D73: operator new(unsigned long) ( in /grid/fermiapp/nova/novaart/externals-0.2.0/art/v0_06_01/slf5.x86_$ ==7158== by 0x4F79E1F: operator new[](unsigned long) ( in /grid/fermiapp/nova/novaart/externals-0.2.0/art/v0_06_01/slf5.x8$ ==7158== by 0x9C415A6: TStringRef::GetRep(int, int) (TString.cxx:145) ==7158== by 0x9C42C57: TString::Replace(int, int, char const*, int) (TString.cxx:775) ==7158== LEAK SUMMARY: ==7158== definitely lost: 6,253 bytes in 65 blocks ==7158== indirectly lost: 418,233 bytes in 2,693 blocks ==7158== possibly lost: 881,436 bytes in 16,114 blocks ==7158== still reachable: 22,613,092 bytes in 101,826 blocks ==7158== suppressed: 0 bytes in 0 blocks ==7158== Reachable blocks (those to which a pointer was found) are not shown. ==7158== To see them, rerun with: --leak-check=full --show-reachable=yes ==7158== ==7158== For counts of detected and suppressed errors, rerun with: -v ==7158== ERROR SUMMARY: 1821 errors from 1821 contexts (suppressed: 2330 from 23) Leak 171kb possibly malloc funktion in file vg_replace_malloc.c on line 236 in /grid/fermiapp/nova/novaart/externals-0.2.0/art/v0_06_01/slf5.x86_$ Need to check? grid/fermiapp/nova/novaart/externals-0.2.0/art/v0_06_01/slf5.x86_$ 5
Memory leaking: correcting After first report main source of leaking has been identified and corrected (g4nova package). 6