summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp205
1 files changed, 65 insertions, 140 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 464e216cf0..d9273dfcb5 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;
@@ -797,7 +799,6 @@ bool LLAppViewer::init()
initMaxHeapSize() ;
LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
- LLPrivateMemoryPoolManager::initClass((BOOL)gSavedSettings.getBOOL("MemoryPrivatePoolEnabled"), (U32)gSavedSettings.getU32("MemoryPrivatePoolSize")*1024*1024) ;
// write Google Breakpad minidump files to a per-run dump directory to avoid multiple viewer issues.
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
mDumpPath = logdir;
@@ -1318,13 +1319,49 @@ LLTrace::BlockTimerStatHandle FTM_FRAME("Frame");
bool LLAppViewer::frame()
{
+ bool ret = false;
+
+ if (gSimulateMemLeak)
+ {
+ try
+ {
+ ret = doFrame();
+ }
+ catch (const LLContinueError&)
+ {
+ LOG_UNHANDLED_EXCEPTION("");
+ }
+ 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
+ {
+ try
+ {
+ ret = doFrame();
+ }
+ catch (const LLContinueError&)
+ {
+ LOG_UNHANDLED_EXCEPTION("");
+ }
+ }
+
+ return ret;
+}
+
+bool LLAppViewer::doFrame()
+{
LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
LLSD newFrame;
- //LLPrivateMemoryPoolTester::getInstance()->run(false) ;
- //LLPrivateMemoryPoolTester::getInstance()->run(true) ;
- //LLPrivateMemoryPoolTester::destroy() ;
-
LL_RECORD_BLOCK_TIME(FTM_FRAME);
LLTrace::BlockTimer::processTimes();
LLTrace::get_frame_recording().nextPeriod();
@@ -1338,7 +1375,6 @@ bool LLAppViewer::frame()
//check memory availability information
checkMemory() ;
- try
{
pingMainloopTimeout("Main:MiscNativeWindowEvents");
@@ -1362,12 +1398,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 +1581,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;
@@ -2078,9 +2070,6 @@ bool LLAppViewer::cleanup()
LLMainLoopRepeater::instance().stop();
- //release all private memory pools.
- LLPrivateMemoryPoolManager::destroyClass() ;
-
ll_close_fail_log();
LLError::LLCallStacks::cleanup();
@@ -3230,7 +3219,7 @@ LLSD LLAppViewer::getViewerInfo() const
return info;
}
-std::string LLAppViewer::getViewerInfoString() const
+std::string LLAppViewer::getViewerInfoString(bool default_string) const
{
std::ostringstream support;
@@ -3240,7 +3229,7 @@ std::string LLAppViewer::getViewerInfoString() const
LLStringUtil::format_map_t args;
// allow the "Release Notes" URL label to be localized
- args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes");
+ args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes", default_string);
for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
ii != iend; ++ii)
@@ -3250,7 +3239,7 @@ std::string LLAppViewer::getViewerInfoString() const
// Scalar value
if (ii->second.isUndefined())
{
- args[ii->first] = LLTrans::getString("none_text");
+ args[ii->first] = LLTrans::getString("none_text", default_string);
}
else
{
@@ -3269,101 +3258,37 @@ std::string LLAppViewer::getViewerInfoString() const
}
// Now build the various pieces
- support << LLTrans::getString("AboutHeader", args);
+ support << LLTrans::getString("AboutHeader", args, default_string);
if (info.has("BUILD_CONFIG"))
{
- support << "\n" << LLTrans::getString("BuildConfig", args);
+ support << "\n" << LLTrans::getString("BuildConfig", args, default_string);
}
if (info.has("REGION"))
{
- support << "\n\n" << LLTrans::getString("AboutPosition", args);
+ support << "\n\n" << LLTrans::getString("AboutPosition", args, default_string);
}
- support << "\n\n" << LLTrans::getString("AboutSystem", args);
+ support << "\n\n" << LLTrans::getString("AboutSystem", args, default_string);
support << "\n";
if (info.has("GRAPHICS_DRIVER_VERSION"))
{
- support << "\n" << LLTrans::getString("AboutDriver", args);
+ support << "\n" << LLTrans::getString("AboutDriver", args, default_string);
}
- support << "\n" << LLTrans::getString("AboutOGL", args);
- support << "\n\n" << LLTrans::getString("AboutSettings", args);
- support << "\n\n" << LLTrans::getString("AboutLibs", args);
+ support << "\n" << LLTrans::getString("AboutOGL", args, default_string);
+ support << "\n\n" << LLTrans::getString("AboutSettings", args, default_string);
+ support << "\n\n" << LLTrans::getString("AboutLibs", args, default_string);
if (info.has("COMPILER"))
{
- support << "\n" << LLTrans::getString("AboutCompiler", args);
+ support << "\n" << LLTrans::getString("AboutCompiler", args, default_string);
}
if (info.has("PACKETS_IN"))
{
- support << '\n' << LLTrans::getString("AboutTraffic", args);
+ support << '\n' << LLTrans::getString("AboutTraffic", args, default_string);
}
// SLT timestamp
LLSD substitution;
substitution["datetime"] = (S32)time(NULL);//(S32)time_corrected();
- support << "\n" << LLTrans::getString("AboutTime", substitution);
-
- return support.str();
-}
-
-std::string LLAppViewer::getShortViewerInfoString() const
-{
- std::ostringstream support;
- LLSD info(getViewerInfo());
-
- support << LLTrans::getString("APP_NAME") << " " << info["VIEWER_VERSION_STR"].asString();
- support << " (" << info["CHANNEL"].asString() << ")";
- if (info.has("BUILD_CONFIG"))
- {
- support << "\n" << "Build Configuration " << info["BUILD_CONFIG"].asString();
- }
- if (info.has("REGION"))
- {
- support << "\n\n" << "You are at " << ll_vector3_from_sd(info["POSITION_LOCAL"]) << " in " << info["REGION"].asString();
- support << " located at " << info["HOSTNAME"].asString() << " (" << info["HOSTIP"].asString() << ")";
- support << "\n" << "SLURL: " << info["SLURL"].asString();
- support << "\n" << "(Global coordinates " << ll_vector3_from_sd(info["POSITION"]) << ")";
- support << "\n" << info["SERVER_VERSION"].asString();
- }
-
- support << "\n\n" << "CPU: " << info["CPU"].asString();
- support << "\n" << "Memory: " << info["MEMORY_MB"].asString() << " MB";
- support << "\n" << "OS: " << info["OS_VERSION"].asString();
- support << "\n" << "Graphics Card: " << info["GRAPHICS_CARD"].asString() << " (" << info["GRAPHICS_CARD_VENDOR"].asString() << ")";
-
- if (info.has("GRAPHICS_DRIVER_VERSION"))
- {
- support << "\n" << "Windows Graphics Driver Version: " << info["GRAPHICS_DRIVER_VERSION"].asString();
- }
-
- support << "\n" << "OpenGL Version: " << info["OPENGL_VERSION"].asString();
-
- support << "\n\n" << "Window size:" << info["WINDOW_WIDTH"].asString() << "x" << info["WINDOW_HEIGHT"].asString();
- support << "\n" << "Language: " << LLUI::getLanguage();
- support << "\n" << "Font Size Adjustment: " << info["FONT_SIZE_ADJUSTMENT"].asString() << "pt";
- support << "\n" << "UI Scaling: " << info["UI_SCALE"].asString();
- support << "\n" << "Draw distance: " << info["DRAW_DISTANCE"].asString();
- support << "\n" << "Bandwidth: " << info["NET_BANDWITH"].asString() << "kbit/s";
- support << "\n" << "LOD factor: " << info["LOD_FACTOR"].asString();
- support << "\n" << "Render quality: " << info["RENDER_QUALITY"].asString() << " / 7";
- support << "\n" << "ALM: " << info["GPU_SHADERS"].asString();
- support << "\n" << "Texture memory: " << info["TEXTURE_MEMORY"].asString() << "MB";
- support << "\n" << "VFS (cache) creation time: " << info["VFS_TIME"].asString();
-
- support << "\n\n" << "J2C Decoder: " << info["J2C_VERSION"].asString();
- support << "\n" << "Audio Driver: " << info["AUDIO_DRIVER_VERSION"].asString();
- support << "\n" << "LLCEFLib/CEF: " << info["LLCEFLIB_VERSION"].asString();
- support << "\n" << "LibVLC: " << info["LIBVLC_VERSION"].asString();
- support << "\n" << "Voice Server: " << info["VOICE_VERSION"].asString();
-
- if (info.has("PACKETS_IN"))
- {
- support << "\n" << "Packets Lost: " << info["PACKETS_LOST"].asInteger() << "/" << info["PACKETS_IN"].asInteger();
- F32 packets_pct = info["PACKETS_PCT"].asReal();
- support << " (" << ll_round(packets_pct, 0.001f) << "%)";
- }
-
- LLSD substitution;
- substitution["datetime"] = (S32)time(NULL);
- support << "\n" << LLTrans::getString("AboutTime", substitution);
+ support << "\n" << LLTrans::getString("AboutTime", substitution, default_string);
return support.str();
}