Commit 8a6481d6 authored by Stefan Hoeche's avatar Stefan Hoeche
Browse files

improved memleak detection, set warning threshold to 16MB

parent 946f724a
...@@ -276,7 +276,7 @@ void Run_Parameter::Init(std::string path,std::string file,int argc,char* argv[] ...@@ -276,7 +276,7 @@ void Run_Parameter::Init(std::string path,std::string file,int argc,char* argv[]
gen.SetVariable("RNG_SEED",ToString(gen.m_seeds[0])+seedstr); gen.SetVariable("RNG_SEED",ToString(gen.m_seeds[0])+seedstr);
gen.SetVariable("MEMLEAK_WARNING_THRESHOLD", gen.SetVariable("MEMLEAK_WARNING_THRESHOLD",
ToString(dr.GetValue<int>("MEMLEAK_WARNING_THRESHOLD",1<<20))); ToString(dr.GetValue<int>("MEMLEAK_WARNING_THRESHOLD",1<<24)));
gen.m_timeout = dr.GetValue<double>("TIMEOUT",std::numeric_limits<double>::max()); gen.m_timeout = dr.GetValue<double>("TIMEOUT",std::numeric_limits<double>::max());
if (gen.m_timeout<0.) gen.m_timeout=0.; if (gen.m_timeout<0.) gen.m_timeout=0.;
rpa->gen.m_timer.Start(); rpa->gen.m_timer.Start();
......
...@@ -308,15 +308,15 @@ bool Phase_Space_Integrator::AddPoint(const double value) ...@@ -308,15 +308,15 @@ bool Phase_Space_Integrator::AddPoint(const double value)
<<" left ) ["<<rpa->gen.Timer().StrFTime("%H:%M:%S")<<"] "<<endl; <<" left ) ["<<rpa->gen.Timer().StrFTime("%H:%M:%S")<<"] "<<endl;
#endif #endif
size_t currentrss=GetCurrentRSS(); size_t currentrss=GetCurrentRSS();
if (currentrss-lastrss>ToType<int> if (currentrss>lastrss+ToType<int>
(rpa->gen.Variable("MEMLEAK_WARNING_THRESHOLD"))) { (rpa->gen.Variable("MEMLEAK_WARNING_THRESHOLD"))) {
msg_Error()<<METHOD<<"() {\n"<<om::bold<<" Memory usage increased by " msg_Error()<<METHOD<<"() {\n"<<om::bold<<" Memory usage increased by "
<<(currentrss-lastrss)/(1<<20)<<" MB," <<(currentrss-lastrss)/(1<<20)<<" MB,"
<<" now "<<currentrss/(1<<20)<<" MB.\n" <<" now "<<currentrss/(1<<20)<<" MB.\n"
<<om::red<<" This might indicate a memory leak!\n" <<om::red<<" This might indicate a memory leak!\n"
<<" Please monitor this process closely.\n"<<om::reset<<"}"<<std::endl; <<" Please monitor this process closely.\n"<<om::reset<<"}"<<std::endl;
lastrss=currentrss;
} }
lastrss=currentrss;
std::vector<double> stats(6); std::vector<double> stats(6);
stats[0]=psh->Process()->TotalResult()*rpa->Picobarn(); stats[0]=psh->Process()->TotalResult()*rpa->Picobarn();
stats[1]=psh->Process()->TotalVar()*rpa->Picobarn(); stats[1]=psh->Process()->TotalVar()*rpa->Picobarn();
......
...@@ -480,15 +480,15 @@ void Event_Handler::MPISync() ...@@ -480,15 +480,15 @@ void Event_Handler::MPISync()
} }
#endif #endif
size_t currentrss=GetCurrentRSS(); size_t currentrss=GetCurrentRSS();
if (currentrss-m_lastrss>ToType<int> if (currentrss>m_lastrss+ToType<int>
(rpa->gen.Variable("MEMLEAK_WARNING_THRESHOLD"))) { (rpa->gen.Variable("MEMLEAK_WARNING_THRESHOLD"))) {
msg_Error()<<METHOD<<"() {\n"<<om::bold<<" Memory usage increased by " msg_Error()<<METHOD<<"() {\n"<<om::bold<<" Memory usage increased by "
<<(currentrss-m_lastrss)/(1<<20)<<" MB," <<(currentrss-m_lastrss)/(1<<20)<<" MB,"
<<" now "<<currentrss/(1<<20)<<" MB.\n" <<" now "<<currentrss/(1<<20)<<" MB.\n"
<<om::red<<" This might indicate a memory leak!\n" <<om::red<<" This might indicate a memory leak!\n"
<<" Please monitor this process closely.\n"<<om::reset<<"}"<<std::endl; <<" Please monitor this process closely.\n"<<om::reset<<"}"<<std::endl;
m_lastrss=currentrss;
} }
m_lastrss=currentrss;
} }
double Event_Handler::TotalXS() double Event_Handler::TotalXS()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment