diff options
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 94 |
1 files changed, 40 insertions, 54 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index b33b3a6410..3b11c9ff75 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -353,6 +353,8 @@ BOOL gCrashOnStartup = FALSE; BOOL gLLErrorActivated = FALSE; BOOL gLogoutInProgress = FALSE; +BOOL gSimulateMemLeak = FALSE; + //////////////////////////////////////////////////////////// // Internal globals... that should be removed. static std::string gArgs; @@ -1318,6 +1320,35 @@ LLTrace::BlockTimerStatHandle FTM_FRAME("Frame"); bool LLAppViewer::frame() { + bool ret = false; + + if (gSimulateMemLeak) + { + try + { + ret = doFrame(); + } + catch (std::bad_alloc) + { + LLMemory::logMemoryInfo(TRUE); + LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); + if (mem_leak_instance) + { + mem_leak_instance->stop(); + } + LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL; + } + } + else + { + ret = doFrame(); + } + + return ret; +} + +bool LLAppViewer::doFrame() +{ LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); LLSD newFrame; @@ -1338,7 +1369,6 @@ bool LLAppViewer::frame() //check memory availability information checkMemory() ; - try { pingMainloopTimeout("Main:MiscNativeWindowEvents"); @@ -1362,12 +1392,15 @@ bool LLAppViewer::frame() } //memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); - if(mem_leak_instance) + if (gSimulateMemLeak) { - mem_leak_instance->idle() ; - } + LLFloaterMemLeak* mem_leak_instance = + LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); + if (mem_leak_instance) + { + mem_leak_instance->idle(); + } + } // canonical per-frame event mainloop.post(newFrame); @@ -1542,60 +1575,13 @@ bool LLAppViewer::frame() pingMainloopTimeout("Main:End"); } } - catch (const LLContinueError&) - { - LOG_UNHANDLED_EXCEPTION(""); - } - catch(std::bad_alloc) - { - LLMemory::logMemoryInfo(TRUE) ; - - //stop memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); - if(mem_leak_instance) - { - mem_leak_instance->stop() ; - LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL ; - } - else - { - //output possible call stacks to log file. - LLError::LLCallStacks::print() ; - - LL_ERRS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL ; - } - } - catch (...) - { - CRASH_ON_UNHANDLED_EXCEPTION(""); - } if (LLApp::isExiting()) { // Save snapshot for next time, if we made it through initialization if (STATE_STARTED == LLStartUp::getStartupState()) { - try - { - saveFinalSnapshot(); - } - catch(std::bad_alloc) - { - LL_WARNS() << "Bad memory allocation when saveFinalSnapshot() is called!" << LL_ENDL ; - - //stop memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); - if(mem_leak_instance) - { - mem_leak_instance->stop() ; - } - } - catch (...) - { - CRASH_ON_UNHANDLED_EXCEPTION("saveFinalSnapshot()"); - } + saveFinalSnapshot(); } delete gServicePump; |