Dear all,
I am trying to build an application to simulate a scintillation detector by a neutron source.
However, there seems to be a memory leak, by looking at PC’s memory usage slowly rising.
So I ran valgrind to verify the problem, and other than most of the message, I saw:
==10375== at 0x8D894F5: __printf_fp_l (printf_fp.c:673)
==10375== by 0x8D85A06: vfprintf (vfprintf.c:1642)
==10375== by 0x8DB190F: vsnprintf (vsnprintf.c:114)
==10375== by 0x8861CBB: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10375== by 0x88909D6: std::ostreambuf_iterator<char, std::char_traits > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits > >::_M_insert_float(std::ostreambuf_iterator<char, std::char_traits >, std::ios_base&, char, char, double) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10375== by 0x889CB8B: std::ostream& std::ostream::_M_insert(double) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10375== by 0x72A51F4: tools::wcsv::ntuple::column::add() (in /home/nuplex/G4/install/lib/libG4analysis.so)
==10375== by 0x72A9681: G4TNtupleManagertools::wcsv::ntuple::AddNtupleRow(int) (in /home/nuplex/G4/install/lib/libG4analysis.so)
==10375== by 0x11B862: G4VAnalysisManager::AddNtupleRow() (G4VAnalysisManager.icc:111)
==10375== by 0x11B395: PracticeSteppingAction::UserSteppingAction(G4Step const*) (PracticeSteppingAction.cc:113)
==10375== by 0x6F2AD64: G4SteppingManager::Stepping() (in /home/nuplex/G4/install/lib/libG4tracking.so)
==10375== by 0x6F36131: G4TrackingManager::ProcessOneTrack(G4Track*) (in /home/nuplex/G4/install/lib/libG4tracking.so)
==10375== Uninitialised value was created by a stack allocation
==10375== at 0x11AFA7: PracticeSteppingAction::UserSteppingAction(G4Step const*) (PracticeSteppingAction.cc:36)
it says uninitialized value was created by a stack allocation.
I collect my output result from Steppingaction::UserSteppingAction(such as edep) and use FillNtupleDColumn right after that to fill my output file (separated by each thread). Maybe I am doing something wrong here?
I appreciate much for any insights. Thanks.