summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-07-19 23:48:11 -0600
committerXiaohong Bao <bao@lindenlab.com>2011-07-19 23:48:11 -0600
commit83e48f4a5100ab1adadc27a3e7a0b23b68b8b568 (patch)
tree68a2b81442389d1f9e54bce3dca5bc0e47b7a3e6 /indra/newview
parent4dc0850da7469906e5ad052da71830b05005295b (diff)
parent76eca5d0bce3e303f6d77b0d16f114320830ac6a (diff)
Merge
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml33
-rw-r--r--indra/newview/llappviewer.cpp176
-rw-r--r--indra/newview/llappviewer.h10
-rw-r--r--indra/newview/llappviewerlinux.cpp1
-rw-r--r--indra/newview/llappviewerlinux_api_dbus.cpp14
-rw-r--r--indra/newview/llappviewermacosx.cpp1
-rw-r--r--indra/newview/lldynamictexture.cpp3
-rw-r--r--indra/newview/llfloateranimpreview.cpp3
-rw-r--r--indra/newview/llfloatermemleak.cpp5
-rw-r--r--indra/newview/llfloatermodelpreview.cpp4
-rw-r--r--indra/newview/llmainlooprepeater.cpp2
-rw-r--r--indra/newview/llmeshrepository.cpp16
-rw-r--r--indra/newview/lltexturecache.cpp91
-rw-r--r--indra/newview/lltexturecache.h3
-rw-r--r--indra/newview/lltexturefetch.cpp17
-rw-r--r--indra/newview/llviewerdisplay.cpp7
-rw-r--r--indra/newview/llviewermenufile.cpp5
-rw-r--r--indra/newview/llviewertexture.cpp12
-rw-r--r--indra/newview/llviewertexture.h2
-rw-r--r--indra/newview/llviewerwindow.cpp33
-rw-r--r--indra/newview/llvoavatar.cpp3
-rw-r--r--indra/newview/llvocache.cpp54
-rw-r--r--indra/newview/llvocache.h5
-rw-r--r--indra/newview/llvoicevivox.cpp2
-rw-r--r--indra/newview/llwatchdog.cpp4
-rw-r--r--indra/newview/llworld.cpp6
-rw-r--r--indra/newview/pipeline.cpp20
-rw-r--r--indra/newview/pipeline.h5
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml10
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml14
-rw-r--r--indra/newview/tests/llworldmap_test.cpp1
31 files changed, 375 insertions, 187 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 58b0879fde..72792d1b04 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1924,6 +1924,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>DebugShowPrivateMem</key>
+ <map>
+ <key>Comment</key>
+ <string>Show Private Mem Info</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>DebugShowRenderInfo</key>
<map>
<key>Comment</key>
@@ -5413,6 +5424,17 @@
<key>Value</key>
<real>48.0</real>
</map>
+ <key>MaxHeapSize</key>
+ <map>
+ <key>Comment</key>
+ <string>Maximum heap size (GB)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.6</real>
+ </map>
<key>MaxSelectDistance</key>
<map>
<key>Comment</key>
@@ -5534,6 +5556,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>MemeoyFailurePreventionEnabled</key>
+ <map>
+ <key>Comment</key>
+ <string>If set, the viewer will quit to avoid crash when memory failure happens</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>MemoryLogFrequency</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 862fc49c0e..b7f4cb92cd 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -650,7 +650,7 @@ LLAppViewer::~LLAppViewer()
}
bool LLAppViewer::init()
-{
+{
//
// Start of the application
//
@@ -683,6 +683,9 @@ bool LLAppViewer::init()
LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
+ //set the max heap size.
+ initMaxHeapSize() ;
+
// write Google Breakpad minidump files to our log directory
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
logdir += gDirUtilp->getDirDelimiter();
@@ -1046,9 +1049,97 @@ bool LLAppViewer::init()
LLAgentLanguage::init();
+ return true;
+}
+void LLAppViewer::initMaxHeapSize()
+{
+ //set the max heap size.
+ //here is some info regarding to the max heap size:
+ //------------------------------------------------------------------------------------------
+ // OS | setting | SL address bits | max manageable memory space | max heap size
+ // Win 32 | default | 32-bit | 2GB | < 1.7GB
+ // Win 32 | /3G | 32-bit | 3GB | < 1.7GB or 2.7GB
+ //Linux 32 | default | 32-bit | 3GB | < 2.7GB
+ //Linux 32 |HUGEMEM | 32-bit | 4GB | < 3.7GB
+ //64-bit OS |default | 32-bit | 4GB | < 3.7GB
+ //64-bit OS |default | 64-bit | N/A (> 4GB) | N/A (> 4GB)
+ //------------------------------------------------------------------------------------------
+ //currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB.
+
+ //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ;
+ F32 max_heap_size_gb = gSavedSettings.getF32("MaxHeapSize") ;
+ BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemeoyFailurePreventionEnabled") ;
+
+ LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ;
+}
- return true;
+void LLAppViewer::checkMemory()
+{
+ const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second
+ //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds
+ const static U32 MAX_SIZE_CHECKED_MEMORY_BLOCK = 64 * 1024 * 1024 ; //64 MB
+ //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ;
+ static void* last_reserved_address = NULL ;
+
+ if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32())
+ {
+ return ;
+ }
+ mMemCheckTimer.reset() ;
+
+ if(gGLManager.mDebugGPU)
+ {
+ //update the availability of memory
+ LLMemory::updateMemoryInfo() ;
+ }
+
+ //check the virtual address space fragmentation
+ if(!last_reserved_address)
+ {
+ last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ;
+ }
+ else
+ {
+ last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ;
+ if(!last_reserved_address) //failed, try once more
+ {
+ last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ;
+ }
+ }
+
+ S32 is_low = !last_reserved_address || LLMemory::isMemoryPoolLow() ;
+
+ //if(is_low < 0) //to force quit
+ //{
+ // if(force_quit_timer > MAX_QUIT_WAIT_TIME) //just hit the limit for the first time
+ // {
+ // //send out the notification to tell the viewer is about to quit in 30 seconds.
+ // LLNotification::Params params("ForceQuitDueToLowMemory");
+ // LLNotifications::instance().add(params);
+
+ // force_quit_timer = MAX_QUIT_WAIT_TIME - MEMORY_CHECK_INTERVAL ;
+ // }
+ // else
+ // {
+ // force_quit_timer -= MEMORY_CHECK_INTERVAL ;
+ // if(force_quit_timer < 0.f)
+ // {
+ // forceQuit() ; //quit
+ // }
+ // }
+ //}
+ //else
+ //{
+ // force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ;
+ //}
+
+ LLPipeline::throttleNewMemoryAllocation(!is_low ? FALSE : TRUE) ;
+
+ if(is_low)
+ {
+ LLMemory::logMemoryInfo() ;
+ }
}
static LLFastTimer::DeclareTimer FTM_MESSAGES("System Messages");
@@ -1076,7 +1167,7 @@ bool LLAppViewer::mainLoop()
//-------------------------------------------
// Create IO Pump to use for HTTP Requests.
- gServicePump = new LLPumpIO(gAPRPoolp);
+ gServicePump = new LLPumpIO;
LLHTTPClient::setPump(*gServicePump);
LLCurl::setCAFile(gDirUtilp->getCAFile());
@@ -1086,7 +1177,6 @@ bool LLAppViewer::mainLoop()
LLVoiceClient::getInstance()->init(gServicePump);
LLTimer frameTimer,idleTimer;
LLTimer debugTime;
- LLFrameTimer memCheckTimer;
LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
joystick->setNeedsReset(true);
@@ -1097,7 +1187,9 @@ bool LLAppViewer::mainLoop()
// point of posting.
LLSD newFrame;
- const F32 memory_check_interval = 1.0f ; //second
+ //LLPrivateMemoryPoolTester::getInstance()->run(false) ;
+ //LLPrivateMemoryPoolTester::getInstance()->run(true) ;
+ //LLPrivateMemoryPoolTester::destroy() ;
// Handle messages
while (!LLApp::isExiting())
@@ -1108,18 +1200,8 @@ bool LLAppViewer::mainLoop()
llclearcallstacks;
//check memory availability information
- {
- if(memory_check_interval < memCheckTimer.getElapsedTimeF32())
- {
- memCheckTimer.reset() ;
-
- //update the availability of memory
- LLMemoryInfo::getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ;
- }
- llcallstacks << "Available physical mem(KB): " << mAvailPhysicalMemInKB << llcallstacksendl ;
- llcallstacks << "Available virtual mem(KB): " << mAvailVirtualMemInKB << llcallstacksendl ;
- }
-
+ checkMemory() ;
+
try
{
pingMainloopTimeout("Main:MiscNativeWindowEvents");
@@ -1283,7 +1365,7 @@ bool LLAppViewer::mainLoop()
idleTimer.reset();
bool is_slow = (frameTimer.getElapsedTimeF64() > FRAME_SLOW_THRESHOLD) ;
S32 total_work_pending = 0;
- S32 total_io_pending = 0;
+ S32 total_io_pending = 0;
while(!is_slow)//do not unpause threads if the frame rates are very low.
{
S32 work_pending = 0;
@@ -1351,15 +1433,7 @@ bool LLAppViewer::mainLoop()
}
catch(std::bad_alloc)
{
- {
- llinfos << "Availabe physical memory(KB) at the beginning of the frame: " << mAvailPhysicalMemInKB << llendl ;
- llinfos << "Availabe virtual memory(KB) at the beginning of the frame: " << mAvailVirtualMemInKB << llendl ;
-
- LLMemoryInfo::getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ;
-
- llinfos << "Current availabe physical memory(KB): " << mAvailPhysicalMemInKB << llendl ;
- llinfos << "Current availabe virtual memory(KB): " << mAvailVirtualMemInKB << llendl ;
- }
+ LLMemory::logMemoryInfo(TRUE) ;
//stop memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
@@ -1452,16 +1526,16 @@ bool LLAppViewer::cleanup()
}
// *TODO - generalize this and move DSO wrangling to a helper class -brad
- std::set<struct apr_dso_handle_t *>::const_iterator i;
- for(i = mPlugins.begin(); i != mPlugins.end(); ++i)
+ for(std::map<apr_dso_handle_t*, boost::shared_ptr<LLAPRPool> >::iterator plugin = mPlugins.begin();
+ plugin != mPlugins.end(); ++plugin)
{
int (*ll_plugin_stop_func)(void) = NULL;
- apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, *i, "ll_plugin_stop");
+ apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, plugin->first, "ll_plugin_stop");
ll_plugin_stop_func();
- rv = apr_dso_unload(*i);
+ rv = apr_dso_unload(plugin->first);
}
- mPlugins.clear();
+ mPlugins.clear(); // Forget handles and destroy all memory pools.
//flag all elements as needing to be destroyed immediately
// to ensure shutdown order
@@ -1843,6 +1917,9 @@ bool LLAppViewer::cleanup()
LLMainLoopRepeater::instance().stop();
+ //release all private memory pools.
+ LLPrivateMemoryPoolManager::destroyClass() ;
+
ll_close_fail_log();
MEM_TRACK_RELEASE
@@ -1894,7 +1971,7 @@ bool LLAppViewer::initThreads()
if (LLFastTimer::sLog || LLFastTimer::sMetricLog)
{
- LLFastTimer::sLogLock = new LLMutex(NULL);
+ LLFastTimer::sLogLock = new LLMutex;
mFastTimerLogThread = new LLFastTimerLogThread(LLFastTimer::sLogName);
mFastTimerLogThread->start();
}
@@ -3142,8 +3219,7 @@ void LLAppViewer::handleViewerCrash()
else crash_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,ERROR_MARKER_FILE_NAME);
llinfos << "Creating crash marker file " << crash_file_name << llendl;
- LLAPRFile crash_file ;
- crash_file.open(crash_file_name, LL_APR_W);
+ LLAPRFile crash_file(crash_file_name, LL_APR_W);
if (crash_file.getFileHandle())
{
LL_INFOS("MarkerFile") << "Created crash marker file " << crash_file_name << LL_ENDL;
@@ -3207,11 +3283,10 @@ bool LLAppViewer::anotherInstanceRunning()
LL_DEBUGS("MarkerFile") << "Checking marker file for lock..." << LL_ENDL;
//Freeze case checks
- if (LLAPRFile::isExist(marker_file, NULL, LL_APR_RB))
+ if (LLAPRFile::isExist(marker_file, LL_APR_RB))
{
// File exists, try opening with write permissions
- LLAPRFile outfile ;
- outfile.open(marker_file, LL_APR_WB);
+ LLAPRFile outfile(marker_file, LL_APR_WB);
apr_file_t* fMarker = outfile.getFileHandle() ;
if (!fMarker)
{
@@ -3250,25 +3325,25 @@ void LLAppViewer::initMarkerFile()
std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
- if (LLAPRFile::isExist(mMarkerFileName, NULL, LL_APR_RB) && !anotherInstanceRunning())
+ if (LLAPRFile::isExist(mMarkerFileName, LL_APR_RB) && !anotherInstanceRunning())
{
gLastExecEvent = LAST_EXEC_FROZE;
LL_INFOS("MarkerFile") << "Exec marker found: program froze on previous execution" << LL_ENDL;
}
- if(LLAPRFile::isExist(logout_marker_file, NULL, LL_APR_RB))
+ if(LLAPRFile::isExist(logout_marker_file, LL_APR_RB))
{
gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
LLAPRFile::remove(logout_marker_file);
}
- if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB))
+ if(LLAPRFile::isExist(llerror_marker_file, LL_APR_RB))
{
if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
else gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
LLAPRFile::remove(llerror_marker_file);
}
- if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
+ if(LLAPRFile::isExist(error_marker_file, LL_APR_RB))
{
if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
else gLastExecEvent = LAST_EXEC_OTHER_CRASH;
@@ -3284,7 +3359,7 @@ void LLAppViewer::initMarkerFile()
// Create the marker file for this execution & lock it
apr_status_t s;
- s = mMarkerFile.open(mMarkerFileName, LL_APR_W, TRUE);
+ s = mMarkerFile.open(mMarkerFileName, LL_APR_W, LLAPRFile::long_lived);
if (s == APR_SUCCESS && mMarkerFile.getFileHandle())
{
@@ -4526,8 +4601,7 @@ void LLAppViewer::sendLogoutRequest()
gLogoutInProgress = TRUE;
mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME);
- LLAPRFile outfile ;
- outfile.open(mLogoutMarkerFileName, LL_APR_W);
+ LLAPRFile outfile(mLogoutMarkerFileName, LL_APR_W);
mLogoutMarkerFile = outfile.getFileHandle() ;
if (mLogoutMarkerFile)
{
@@ -4979,14 +5053,15 @@ void LLAppViewer::loadEventHostModule(S32 listen_port)
}
#endif // LL_WINDOWS
- apr_dso_handle_t * eventhost_dso_handle = NULL;
- apr_pool_t * eventhost_dso_memory_pool = NULL;
+ boost::shared_ptr<LLAPRPool> eventhost_dso_memory_pool_ptr(new LLAPRPool);
+ LLAPRPool& eventhost_dso_memory_pool(*eventhost_dso_memory_pool_ptr);
+ apr_dso_handle_t* eventhost_dso_handle = NULL;
//attempt to load the shared library
- apr_pool_create(&eventhost_dso_memory_pool, NULL);
+ eventhost_dso_memory_pool.create();
apr_status_t rv = apr_dso_load(&eventhost_dso_handle,
dso_path.c_str(),
- eventhost_dso_memory_pool);
+ eventhost_dso_memory_pool());
llassert_always(! ll_apr_warn_status(rv, eventhost_dso_handle));
llassert_always(eventhost_dso_handle != NULL);
@@ -5006,7 +5081,8 @@ void LLAppViewer::loadEventHostModule(S32 listen_port)
llerrs << "problem loading eventhost plugin, status: " << status << llendl;
}
- mPlugins.insert(eventhost_dso_handle);
+ // Store the handle and link it to the pool that was used to allocate it.
+ mPlugins[eventhost_dso_handle] = eventhost_dso_memory_pool_ptr;
}
void LLAppViewer::launchUpdater()
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 61ee6a7cf1..41de64891e 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -168,7 +168,7 @@ public:
// mute/unmute the system's master audio
virtual void setMasterSystemAudioMute(bool mute);
- virtual bool getMasterSystemAudioMute();
+ virtual bool getMasterSystemAudioMute();
// Metrics policy helper statics.
static void metricsUpdateRegion(U64 region_handle);
@@ -191,11 +191,12 @@ protected:
private:
+ void initMaxHeapSize();
bool initThreads(); // Initialize viewer threads, return false on failure.
bool initConfiguration(); // Initialize settings from the command line/config file.
void initUpdater(); // Initialize the updater service.
bool initCache(); // Initialize local client cache.
-
+ void checkMemory() ;
// We have switched locations of both Mac and Windows cache, make sure
// files migrate and old cache is cleared out.
@@ -267,10 +268,9 @@ private:
LLAllocator mAlloc;
- std::set<struct apr_dso_handle_t*> mPlugins;
+ std::map<apr_dso_handle_t*, boost::shared_ptr<LLAPRPool> > mPlugins;
- U32 mAvailPhysicalMemInKB ;
- U32 mAvailVirtualMemInKB ;
+ LLFrameTimer mMemCheckTimer;
boost::scoped_ptr<LLUpdaterService> mUpdater;
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 48d02dfeaa..db11462fcb 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -111,6 +111,7 @@ int main( int argc, char **argv )
}
delete viewer_app_ptr;
viewer_app_ptr = NULL;
+
return 0;
}
diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp
index 32e7e0a83d..1ae469dfcf 100644
--- a/indra/newview/llappviewerlinux_api_dbus.cpp
+++ b/indra/newview/llappviewerlinux_api_dbus.cpp
@@ -27,11 +27,11 @@
#if LL_DBUS_ENABLED
#include "linden_common.h"
+#include "llaprpool.h"
extern "C" {
#include <dbus/dbus-glib.h>
-#include "apr_pools.h"
#include "apr_dso.h"
}
@@ -44,7 +44,7 @@ extern "C" {
#undef LL_DBUS_SYM
static bool sSymsGrabbed = false;
-static apr_pool_t *sSymDBUSDSOMemoryPool = NULL;
+static LLAPRPool sSymDBUSDSOMemoryPool;
static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL;
bool grab_dbus_syms(std::string dbus_dso_name)
@@ -63,11 +63,11 @@ bool grab_dbus_syms(std::string dbus_dso_name)
#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0)
//attempt to load the shared library
- apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
+ sSymDBUSDSOMemoryPool.create();
if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
dbus_dso_name.c_str(),
- sSymDBUSDSOMemoryPool) ))
+ sSymDBUSDSOMemoryPool()) ))
{
INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
@@ -109,11 +109,7 @@ void ungrab_dbus_syms()
sSymDBUSDSOHandleG = NULL;
}
- if ( sSymDBUSDSOMemoryPool )
- {
- apr_pool_destroy(sSymDBUSDSOMemoryPool);
- sSymDBUSDSOMemoryPool = NULL;
- }
+ sSymDBUSDSOMemoryPool.destroy();
// NULL-out all of the symbols we'd grabbed
#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0)
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index c2916717bd..8929c0c1a4 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -113,6 +113,7 @@ int main( int argc, char **argv )
}
delete viewer_app_ptr;
viewer_app_ptr = NULL;
+
return 0;
}
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index f781d5f3ff..fb9958ee9d 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -40,6 +40,7 @@
#include "llvertexbuffer.h"
#include "llviewerdisplay.h"
#include "llrender.h"
+#include "pipeline.h"
// static
LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
@@ -201,7 +202,7 @@ void LLViewerDynamicTexture::postRender(BOOL success)
BOOL LLViewerDynamicTexture::updateAllInstances()
{
sNumRenders = 0;
- if (gGLManager.mIsDisabled)
+ if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled)
{
return TRUE;
}
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index 1f334815d6..9f0218a95e 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -223,8 +223,7 @@ BOOL LLFloaterAnimPreview::postBuild()
// now load bvh file
S32 file_size;
- LLAPRFile infile ;
- infile.open(mFilenameAndPath, LL_APR_RB, NULL, &file_size);
+ LLAPRFile infile(mFilenameAndPath, LL_APR_RB, &file_size);
if (!infile.getFileHandle())
{
diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp
index 58931d112e..9edfe1e354 100644
--- a/indra/newview/llfloatermemleak.cpp
+++ b/indra/newview/llfloatermemleak.cpp
@@ -90,6 +90,11 @@ LLFloaterMemLeak::~LLFloaterMemLeak()
void LLFloaterMemLeak::release()
{
+ if(mLeakedMem.empty())
+ {
+ return ;
+ }
+
for(S32 i = 0 ; i < (S32)mLeakedMem.size() ; i++)
{
delete[] mLeakedMem[i] ;
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ab6753b4be..c0cad8aebc 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -359,7 +359,7 @@ LLFloater(key)
mLastMouseX = 0;
mLastMouseY = 0;
mGLName = 0;
- mStatusLock = new LLMutex(NULL);
+ mStatusLock = new LLMutex();
mLODMode[LLModel::LOD_HIGH] = 0;
for (U32 i = 0; i < LLModel::LOD_HIGH; i++)
@@ -2814,7 +2814,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element)
//-----------------------------------------------------------------------------
LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
-: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL)
+: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex()
, mPelvisZOffset( 0.0f )
, mLegacyRigValid( false )
, mRigValidJointUpload( false )
diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp
index 5c020e6d98..d73048a28b 100644
--- a/indra/newview/llmainlooprepeater.cpp
+++ b/indra/newview/llmainlooprepeater.cpp
@@ -46,7 +46,7 @@ void LLMainLoopRepeater::start(void)
{
if(mQueue != 0) return;
- mQueue = new LLThreadSafeQueue<LLSD>(gAPRPoolp, 1024);
+ mQueue = new LLThreadSafeQueue<LLSD>(1024);
mMainLoopConnection = LLEventPumps::instance().
obtain("mainloop").listen(LLEventPump::inventName(), boost::bind(&LLMainLoopRepeater::onMainLoop, this, _1));
mRepeaterConnection = LLEventPumps::instance().
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 6e0722bcf9..85bcca2e01 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -625,12 +625,12 @@ public:
};
LLMeshRepoThread::LLMeshRepoThread()
-: LLThread("mesh repo", NULL)
+: LLThread("mesh repo")
{
mWaiting = false;
- mMutex = new LLMutex(NULL);
- mHeaderMutex = new LLMutex(NULL);
- mSignal = new LLCondition(NULL);
+ mMutex = new LLMutex();
+ mHeaderMutex = new LLMutex();
+ mSignal = new LLCondition();
}
LLMeshRepoThread::~LLMeshRepoThread()
@@ -1371,7 +1371,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data,
mUploadTextures = upload_textures;
mUploadSkin = upload_skin;
mUploadJoints = upload_joints;
- mMutex = new LLMutex(NULL);
+ mMutex = new LLMutex();
mCurlRequest = NULL;
mPendingConfirmations = 0;
mPendingUploads = 0;
@@ -2201,7 +2201,7 @@ LLMeshRepository::LLMeshRepository()
void LLMeshRepository::init()
{
- mMeshMutex = new LLMutex(NULL);
+ mMeshMutex = new LLMutex();
LLConvexDecomposition::getInstance()->initSystem();
@@ -3245,8 +3245,8 @@ LLPhysicsDecomp::LLPhysicsDecomp()
mQuitting = false;
mDone = false;
- mSignal = new LLCondition(NULL);
- mMutex = new LLMutex(NULL);
+ mSignal = new LLCondition();
+ mMutex = new LLMutex();
}
LLPhysicsDecomp::~LLPhysicsDecomp()
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 9b417307fd..87b6304f9d 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -113,7 +113,7 @@ public:
~LLTextureCacheWorker()
{
llassert_always(!haveWork());
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
}
// override this interface
@@ -176,7 +176,7 @@ private:
bool LLTextureCacheLocalFileWorker::doRead()
{
- S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool());
+ S32 local_size = LLAPRFile::size(mFileName);
if (local_size > 0 && mFileName.size() > 4)
{
@@ -215,7 +215,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
mDataSize = 0;
return true;
}
- mReadData = new U8[mDataSize];
+ mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
mBytesRead = -1;
mBytesToRead = mDataSize;
setPriority(LLWorkerThread::PRIORITY_LOW | mPriority);
@@ -233,7 +233,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
// << " Bytes: " << mDataSize << " Offset: " << mOffset
// << " / " << mDataSize << llendl;
mDataSize = 0; // failed
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
}
return true;
@@ -248,9 +248,9 @@ bool LLTextureCacheLocalFileWorker::doRead()
{
mDataSize = local_size;
}
- mReadData = new U8[mDataSize];
+ mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
- S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+ S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize);
if (bytes_read != mDataSize)
{
@@ -258,7 +258,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
// << " Bytes: " << mDataSize << " Offset: " << mOffset
// << " / " << mDataSize << llendl;
mDataSize = 0;
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
}
else
@@ -331,7 +331,7 @@ bool LLTextureCacheRemoteWorker::doRead()
// Is it a JPEG2000 file?
{
local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename);
if (local_size > 0)
{
mImageFormat = IMG_CODEC_J2C;
@@ -341,7 +341,7 @@ bool LLTextureCacheRemoteWorker::doRead()
if (local_size == 0)
{
local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename);
if (local_size > 0)
{
mImageFormat = IMG_CODEC_JPEG;
@@ -352,7 +352,7 @@ bool LLTextureCacheRemoteWorker::doRead()
if (local_size == 0)
{
local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename);
if (local_size > 0)
{
mImageFormat = IMG_CODEC_TGA;
@@ -377,16 +377,15 @@ bool LLTextureCacheRemoteWorker::doRead()
mDataSize = local_size;
}
// Allocate read buffer
- mReadData = new U8[mDataSize];
- S32 bytes_read = LLAPRFile::readEx(local_filename,
- mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+ mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
+ S32 bytes_read = LLAPRFile::readEx(local_filename, mReadData, mOffset, mDataSize);
if (bytes_read != mDataSize)
{
llwarns << "Error reading file from local cache: " << local_filename
<< " Bytes: " << mDataSize << " Offset: " << mOffset
<< " / " << mDataSize << llendl;
mDataSize = 0;
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
}
else
@@ -429,15 +428,14 @@ bool LLTextureCacheRemoteWorker::doRead()
S32 size = TEXTURE_CACHE_ENTRY_SIZE - mOffset;
size = llmin(size, mDataSize);
// Allocate the read buffer
- mReadData = new U8[size];
- S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName,
- mReadData, offset, size, mCache->getLocalAPRFilePool());
+ mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), size);
+ S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, mReadData, offset, size);
if (bytes_read != size)
{
llwarns << "LLTextureCacheWorker: " << mID
<< " incorrect number of bytes read from header: " << bytes_read
<< " / " << size << llendl;
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
mDataSize = -1; // failed
done = true;
@@ -457,7 +455,7 @@ bool LLTextureCacheRemoteWorker::doRead()
if (!done && (mState == BODY))
{
std::string filename = mCache->getTextureFileName(mID);
- S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool());
+ S32 filesize = LLAPRFile::size(filename);
if (filesize && (filesize + TEXTURE_CACHE_ENTRY_SIZE) > mOffset)
{
@@ -467,7 +465,7 @@ bool LLTextureCacheRemoteWorker::doRead()
S32 data_offset, file_size, file_offset;
// Reserve the whole data buffer first
- U8* data = new U8[mDataSize];
+ U8* data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
// Set the data file pointers taking the read offset into account. 2 cases:
if (mOffset < TEXTURE_CACHE_ENTRY_SIZE)
@@ -480,7 +478,7 @@ bool LLTextureCacheRemoteWorker::doRead()
// Copy the raw data we've been holding from the header cache into the new sized buffer
llassert_always(mReadData);
memcpy(data, mReadData, data_offset);
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
}
else
@@ -499,14 +497,13 @@ bool LLTextureCacheRemoteWorker::doRead()
// Read the data at last
S32 bytes_read = LLAPRFile::readEx(filename,
mReadData + data_offset,
- file_offset, file_size,
- mCache->getLocalAPRFilePool());
+ file_offset, file_size);
if (bytes_read != file_size)
{
llwarns << "LLTextureCacheWorker: " << mID
<< " incorrect number of bytes read from body: " << bytes_read
<< " / " << file_size << llendl;
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
mDataSize = -1; // failed
done = true;
@@ -598,16 +595,16 @@ bool LLTextureCacheRemoteWorker::doWrite()
{
// We need to write a full record in the header cache so, if the amount of data is smaller
// than a record, we need to transfer the data to a buffer padded with 0 and write that
- U8* padBuffer = new U8[TEXTURE_CACHE_ENTRY_SIZE];
+ U8* padBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), TEXTURE_CACHE_ENTRY_SIZE);
memset(padBuffer, 0, TEXTURE_CACHE_ENTRY_SIZE); // Init with zeros
memcpy(padBuffer, mWriteData, mDataSize); // Copy the write buffer
- bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool());
- delete [] padBuffer;
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size);
+ FREE_MEM(LLImageBase::getPrivatePool(), padBuffer);
}
else
{
// Write the header record (== first TEXTURE_CACHE_ENTRY_SIZE bytes of the raw file) in the header file
- bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool());
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size);
}
if (bytes_written <= 0)
@@ -642,8 +639,7 @@ bool LLTextureCacheRemoteWorker::doWrite()
// llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl;
S32 bytes_written = LLAPRFile::writeEx( filename,
mWriteData + TEXTURE_CACHE_ENTRY_SIZE,
- 0, file_size,
- mCache->getLocalAPRFilePool());
+ 0, file_size);
if (bytes_written <= 0)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -698,7 +694,7 @@ void LLTextureCacheWorker::finishWork(S32 param, bool completed)
}
else
{
- delete[] mReadData;
+ FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
mReadData = NULL;
}
}
@@ -740,9 +736,6 @@ void LLTextureCacheWorker::endWork(S32 param, bool aborted)
LLTextureCache::LLTextureCache(bool threaded)
: LLWorkerThread("TextureCache", threaded),
- mWorkersMutex(NULL),
- mHeaderMutex(NULL),
- mListMutex(NULL),
mHeaderAPRFile(NULL),
mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
mTexturesSizeTotal(0),
@@ -846,7 +839,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// Is it a JPEG2000 file?
{
local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename);
if (local_size > 0)
{
return TRUE ;
@@ -856,7 +849,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// If not, is it a jpeg file?
{
local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename);
if (local_size > 0)
{
return TRUE ;
@@ -866,7 +859,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// Hmm... What about a targa file? (used for UI texture mostly)
{
local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename);
if (local_size > 0)
{
return TRUE ;
@@ -912,10 +905,10 @@ void LLTextureCache::purgeCache(ELLPath location)
if(LLFile::isdir(mTexturesDirName))
{
std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename);
- LLAPRFile::remove(file_name, getLocalAPRFilePool());
+ LLAPRFile::remove(file_name);
file_name = gDirUtilp->getExpandedFilename(location, cache_filename);
- LLAPRFile::remove(file_name, getLocalAPRFilePool());
+ LLAPRFile::remove(file_name);
purgeAllTextures(true);
}
@@ -991,7 +984,9 @@ LLAPRFile* LLTextureCache::openHeaderEntriesFile(bool readonly, S32 offset)
{
llassert_always(mHeaderAPRFile == NULL);
apr_int32_t flags = readonly ? APR_READ|APR_BINARY : APR_READ|APR_WRITE|APR_BINARY;
- mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, getLocalAPRFilePool());
+ // All code calling openHeaderEntriesFile, immediately calls closeHeaderEntriesFile,
+ // so this file is very short-lived.
+ mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags);
if(offset > 0)
{
mHeaderAPRFile->seek(APR_SET, offset);
@@ -1014,10 +1009,9 @@ void LLTextureCache::readEntriesHeader()
{
// mHeaderEntriesInfo initializes to default values so safe not to read it
llassert_always(mHeaderAPRFile == NULL);
- if (LLAPRFile::isExist(mHeaderEntriesFileName, getLocalAPRFilePool()))
+ if (LLAPRFile::isExist(mHeaderEntriesFileName))
{
- LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
- getLocalAPRFilePool());
+ LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo));
}
else //create an empty entries header.
{
@@ -1032,8 +1026,7 @@ void LLTextureCache::writeEntriesHeader()
llassert_always(mHeaderAPRFile == NULL);
if (!mReadOnly)
{
- LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
- getLocalAPRFilePool());
+ LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo));
}
}
@@ -1622,7 +1615,7 @@ void LLTextureCache::purgeTextures(bool validate)
if (uuididx == validate_idx)
{
LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mBodySize << LL_ENDL;
- S32 bodysize = LLAPRFile::size(filename, getLocalAPRFilePool());
+ S32 bodysize = LLAPRFile::size(filename);
if (bodysize != entries[idx].mBodySize)
{
LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize
@@ -1857,7 +1850,7 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id)
mTexturesSizeMap.erase(id);
}
mHeaderIDMap.erase(id);
- LLAPRFile::remove(getTextureFileName(id), getLocalAPRFilePool());
+ LLAPRFile::remove(getTextureFileName(id));
}
//called after mHeaderMutex is locked.
@@ -1869,7 +1862,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
{
if (entry.mBodySize == 0) // Always attempt to remove when mBodySize > 0.
{
- if (LLAPRFile::isExist(filename, getLocalAPRFilePool())) // Sanity check. Shouldn't exist when body size is 0.
+ if (LLAPRFile::isExist(filename)) // Sanity check. Shouldn't exist when body size is 0.
{
LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL;
}
@@ -1890,7 +1883,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
if (file_maybe_exists)
{
- LLAPRFile::remove(filename, getLocalAPRFilePool());
+ LLAPRFile::remove(filename);
}
}
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index 64e3a2658c..79f5ba5835 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -142,9 +142,6 @@ protected:
std::string getTextureFileName(const LLUUID& id);
void addCompleted(Responder* responder, bool success);
-protected:
- //void setFileAPRPool(apr_pool_t* pool) { mFileAPRPool = pool ; }
-
private:
void setDirNames(ELLPath location);
void readHeaderCache();
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 18c3a3b87d..e9be45ffd0 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -674,7 +674,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
mRetryAttempt(0),
mActiveCount(0),
mGetStatus(0),
- mWorkMutex(NULL),
mFirstPacket(0),
mLastPacket(-1),
mTotalPackets(0),
@@ -817,7 +816,7 @@ void LLTextureFetchWorker::setImagePriority(F32 priority)
void LLTextureFetchWorker::resetFormattedData()
{
- delete[] mBuffer;
+ FREE_MEM(LLImageBase::getPrivatePool(), mBuffer);
mBuffer = NULL;
mBufferSize = 0;
if (mFormattedImage.notNull())
@@ -888,7 +887,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
mSentRequest = UNSENT;
mDecoded = FALSE;
mWritten = FALSE;
- delete[] mBuffer;
+ FREE_MEM(LLImageBase::getPrivatePool(), mBuffer);
mBuffer = NULL;
mBufferSize = 0;
mHaveAllData = FALSE;
@@ -1284,7 +1283,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
llassert_always(mBufferSize == cur_size + mRequestedSize);
if(!mBufferSize)//no data received.
{
- delete[] mBuffer;
+ FREE_MEM(LLImageBase::getPrivatePool(), mBuffer);
mBuffer = NULL;
//abort.
@@ -1312,7 +1311,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
mFileSize = mBufferSize + 1 ; //flag the file is not fully loaded.
}
- U8* buffer = new U8[mBufferSize];
+ U8* buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mBufferSize);
if (cur_size > 0)
{
memcpy(buffer, mFormattedImage->getData(), cur_size);
@@ -1321,7 +1320,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
// NOTE: setData releases current data and owns new data (buffer)
mFormattedImage->setData(buffer, mBufferSize);
// delete temp data
- delete[] mBuffer; // Note: not 'buffer' (assigned in setData())
+ FREE_MEM(LLImageBase::getPrivatePool(), mBuffer); // Note: not 'buffer' (assigned in setData())
mBuffer = NULL;
mBufferSize = 0;
mLoadedDiscard = mRequestedDiscard;
@@ -1618,7 +1617,7 @@ bool LLTextureFetchWorker::processSimulatorPackets()
if (buffer_size > cur_size)
{
/// We have new data
- U8* buffer = new U8[buffer_size];
+ U8* buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), buffer_size);
S32 offset = 0;
if (cur_size > 0 && mFirstPacket > 0)
{
@@ -1670,7 +1669,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
if (data_size > 0)
{
// *TODO: set the formatted image data here directly to avoid the copy
- mBuffer = new U8[data_size];
+ mBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size);
buffer->readAfter(channels.in(), NULL, mBuffer, data_size);
mBufferSize += data_size;
if (data_size < mRequestedSize && mRequestedDiscard == 0)
@@ -1816,8 +1815,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mDebugPause(FALSE),
mPacketCount(0),
mBadPacketCount(0),
- mQueueMutex(getAPRPool()),
- mNetworkQueueMutex(getAPRPool()),
mTextureCache(cache),
mImageDecodeThread(imagedecodethread),
mTextureBandwidth(0),
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 911fc8e1ed..13c3008b7f 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -202,6 +202,7 @@ void display_stats()
gMemoryAllocated = LLMemory::getCurrentRSS();
U32 memory = (U32)(gMemoryAllocated / (1024*1024));
llinfos << llformat("MEMORY: %d MB", memory) << llendl;
+ LLMemory::logMemoryInfo() ;
gRecentMemoryTime.reset();
}
}
@@ -691,7 +692,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
glh::matrix4f mod = glh_get_current_modelview();
glViewport(0,0,512,512);
LLVOAvatar::updateFreezeCounter() ;
- LLVOAvatar::updateImpostors();
+
+ if(!LLPipeline::sMemAllocationThrottled)
+ {
+ LLVOAvatar::updateImpostors();
+ }
glh_set_current_projection(proj);
glh_set_current_modelview(mod);
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index b9293b3b31..8139f7deda 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -149,7 +149,7 @@ void LLFilePickerThread::run()
//static
void LLFilePickerThread::initClass()
{
- sMutex = new LLMutex(NULL);
+ sMutex = new LLMutex();
}
//static
@@ -816,8 +816,7 @@ LLUUID upload_new_resource(
uuid = tid.makeAssetID(gAgent.getSecureSessionID());
// copy this file into the vfs for upload
S32 file_size;
- LLAPRFile infile ;
- infile.open(filename, LL_APR_RB, NULL, &file_size);
+ LLAPRFile infile(filename, LL_APR_RB, &file_size);
if (infile.getFileHandle())
{
LLVFile file(gVFS, uuid, asset_type, LLVFile::WRITE);
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 4da0f80a00..061c6244f2 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -3101,9 +3101,16 @@ void LLViewerLODTexture::processTextureStats()
{
mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ;
}
+ else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions.
+ {
+ if(scaleDown())
+ {
+ mDesiredDiscardLevel = mCachedRawDiscardLevel ;
+ }
+ }
}
-void LLViewerLODTexture::scaleDown()
+bool LLViewerLODTexture::scaleDown()
{
if(hasGLTexture() && mCachedRawDiscardLevel > getDiscardLevel())
{
@@ -3114,7 +3121,10 @@ void LLViewerLODTexture::scaleDown()
{
tester->setStablizingTime() ;
}
+
+ return true ;
}
+ return false ;
}
//----------------------------------------------------------------------------------------------
//end of LLViewerLODTexture
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index c5b8c8923a..8f4e5bebd3 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -596,7 +596,7 @@ public:
private:
void init(bool firstinit) ;
- void scaleDown() ;
+ bool scaleDown() ;
private:
F32 mDiscardVirtualSize; // Virtual size used to calculate desired discard
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index c31e1c3ba9..3c552c0a08 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -662,6 +662,17 @@ public:
addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3]));
ypos += y_inc;
}
+
+ if (gSavedSettings.getBOOL("DebugShowPrivateMem"))
+ {
+ LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ;
+ addText(xpos, ypos, llformat("Total Reserved(KB): %d", LLPrivateMemoryPoolManager::getInstance()->mTotalReservedSize / 1024));
+ ypos += y_inc;
+
+ addText(xpos, ypos, llformat("Total Allocated(KB): %d", LLPrivateMemoryPoolManager::getInstance()->mTotalAllocatedSize / 1024));
+ ypos += y_inc;
+ }
+
// only display these messages if we are actually rendering beacons at this moment
if (LLPipeline::getRenderBeacons(NULL) && LLFloaterReg::instanceVisible("beacons"))
{
@@ -1645,6 +1656,7 @@ LLViewerWindow::LLViewerWindow(
}
LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable"));
LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
+ gGL.init() ;
if (LLFeatureManager::getInstance()->isSafe()
|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())
@@ -2041,15 +2053,17 @@ void LLViewerWindow::shutdownGL()
llinfos << "All textures and llimagegl images are destroyed!" << llendl ;
llinfos << "Cleaning up select manager" << llendl;
- LLSelectMgr::getInstance()->cleanup();
-
- LLVertexBuffer::cleanupClass();
+ LLSelectMgr::getInstance()->cleanup();
llinfos << "Stopping GL during shutdown" << llendl;
stopGL(FALSE);
stop_glerror();
gGL.shutdown();
+
+ LLVertexBuffer::cleanupClass();
+
+ llinfos << "LLVertexBuffer cleaned." << llendl ;
}
// shutdownViews() and shutdownGL() need to be called first
@@ -4147,6 +4161,19 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
{
return FALSE;
}
+ //check if there is enough memory for the snapshot image
+ if(LLPipeline::sMemAllocationThrottled)
+ {
+ return FALSE ; //snapshot taking is disabled due to memory restriction.
+ }
+ if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K
+ {
+ if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3))
+ {
+ llwarns << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << llendl ;
+ return FALSE ; //there is no enough memory for taking this snapshot.
+ }
+ }
// PRE SNAPSHOT
gDisplaySwapBuffers = FALSE;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3f98df9eb9..ba7f574065 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7494,8 +7494,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
// static
void LLVOAvatar::dumpArchetypeXML( void* )
{
- LLAPRFile outfile;
- outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB );
+ LLAPRFile outfile(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER, "new archetype.xml"), LL_APR_WB);
apr_file_t* file = outfile.getFileHandle() ;
if (!file)
{
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index f0b5b50feb..6d14ab9a44 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -30,14 +30,14 @@
#include "llregionhandle.h"
#include "llviewercontrol.h"
-BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes)
+static BOOL check_read(LLAPRFile& apr_file, void* src, S32 n_bytes)
{
- return apr_file->read(src, n_bytes) == n_bytes ;
+ return apr_file.read(src, n_bytes) == n_bytes ;
}
-BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes)
+static BOOL check_write(LLAPRFile& apr_file, void* src, S32 n_bytes)
{
- return apr_file->write(src, n_bytes) == n_bytes ;
+ return apr_file.write(src, n_bytes) == n_bytes ;
}
@@ -70,7 +70,7 @@ LLVOCacheEntry::LLVOCacheEntry()
mDP.assignBuffer(mBuffer, 0);
}
-LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
+LLVOCacheEntry::LLVOCacheEntry(LLAPRFile& apr_file)
: mBuffer(NULL)
{
S32 size = -1;
@@ -187,7 +187,7 @@ void LLVOCacheEntry::dump() const
<< llendl;
}
-BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const
+BOOL LLVOCacheEntry::writeToFile(LLAPRFile& apr_file) const
{
BOOL success;
success = check_write(apr_file, (void*)&mLocalID, sizeof(U32));
@@ -268,7 +268,6 @@ LLVOCache::LLVOCache():
mCacheSize(1)
{
mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
- mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
}
LLVOCache::~LLVOCache()
@@ -278,7 +277,6 @@ LLVOCache::~LLVOCache()
writeCacheHeader();
clearCacheInMemory();
}
- delete mLocalAPRFilePoolp;
}
void LLVOCache::setDirNames(ELLPath location)
@@ -435,7 +433,7 @@ void LLVOCache::removeFromCache(HeaderEntryInfo* entry)
std::string filename;
getObjectCacheFilename(entry->mHandle, filename);
- LLAPRFile::remove(filename, mLocalAPRFilePoolp);
+ LLAPRFile::remove(filename);
entry->mTime = INVALID_TIME ;
updateEntry(entry) ; //update the head file.
}
@@ -452,12 +450,12 @@ void LLVOCache::readCacheHeader()
clearCacheInMemory();
bool success = true ;
- if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
+ if (LLAPRFile::isExist(mHeaderFileName))
{
- LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY);
//read the meta element
- success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
+ success = check_read(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
if(success)
{
@@ -470,7 +468,7 @@ void LLVOCache::readCacheHeader()
{
entry = new HeaderEntryInfo() ;
}
- success = check_read(&apr_file, entry, sizeof(HeaderEntryInfo));
+ success = check_read(apr_file, entry, sizeof(HeaderEntryInfo));
if(!success) //failed
{
@@ -539,17 +537,17 @@ void LLVOCache::writeCacheHeader()
bool success = true ;
{
- LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY);
//write the meta element
- success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
+ success = check_write(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
mNumEntries = 0 ;
for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter)
{
(*iter)->mIndex = mNumEntries++ ;
- success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo));
+ success = check_write(apr_file, (void*)*iter, sizeof(HeaderEntryInfo));
}
mNumEntries = mHeaderEntryQueue.size() ;
@@ -560,7 +558,7 @@ void LLVOCache::writeCacheHeader()
for(S32 i = mNumEntries ; success && i < MAX_NUM_OBJECT_ENTRIES ; i++)
{
//fill the cache with the default entry.
- success = check_write(&apr_file, entry, sizeof(HeaderEntryInfo)) ;
+ success = check_write(apr_file, entry, sizeof(HeaderEntryInfo)) ;
}
delete entry ;
@@ -577,10 +575,10 @@ void LLVOCache::writeCacheHeader()
BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
{
- LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
- apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
+ LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY);
+ apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo));
- return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
+ return check_write(apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
}
void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map)
@@ -603,10 +601,10 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
{
std::string filename;
getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(filename, APR_READ|APR_BINARY);
LLUUID cache_id ;
- success = check_read(&apr_file, cache_id.mData, UUID_BYTES) ;
+ success = check_read(apr_file, cache_id.mData, UUID_BYTES) ;
if(success)
{
@@ -619,11 +617,11 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
if(success)
{
S32 num_entries;
- success = check_read(&apr_file, &num_entries, sizeof(S32)) ;
+ success = check_read(apr_file, &num_entries, sizeof(S32)) ;
for (S32 i = 0; success && i < num_entries; i++)
{
- LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file);
+ LLVOCacheEntry* entry = new LLVOCacheEntry(apr_file);
if (!entry->getLocalID())
{
llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl;
@@ -722,19 +720,19 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
{
std::string filename;
getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY);
- success = check_write(&apr_file, (void*)id.mData, UUID_BYTES) ;
+ success = check_write(apr_file, (void*)id.mData, UUID_BYTES) ;
if(success)
{
S32 num_entries = cache_entry_map.size() ;
- success = check_write(&apr_file, &num_entries, sizeof(S32));
+ success = check_write(apr_file, &num_entries, sizeof(S32));
for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter)
{
- success = iter->second->writeToFile(&apr_file) ;
+ success = iter->second->writeToFile(apr_file) ;
}
}
}
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 14e3b4c793..76456b9e98 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -41,7 +41,7 @@ class LLVOCacheEntry
{
public:
LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp);
- LLVOCacheEntry(LLAPRFile* apr_file);
+ LLVOCacheEntry(LLAPRFile& apr_file);
LLVOCacheEntry();
~LLVOCacheEntry();
@@ -51,7 +51,7 @@ public:
S32 getCRCChangeCount() const { return mCRCChangeCount; }
void dump() const;
- BOOL writeToFile(LLAPRFile* apr_file) const;
+ BOOL writeToFile(LLAPRFile& apr_file) const;
void assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp);
LLDataPackerBinaryBuffer *getDP(U32 crc);
void recordHit();
@@ -142,7 +142,6 @@ private:
U32 mNumEntries;
std::string mHeaderFileName ;
std::string mObjectCacheDirName;
- LLVolatileAPRPool* mLocalAPRFilePoolp ;
header_entry_queue_t mHeaderEntryQueue;
handle_entry_map_t mHandleEntryMap;
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index cd2bbad620..d45cd9a342 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -942,7 +942,7 @@ void LLVivoxVoiceClient::stateMachine()
if(!mSocket)
{
- mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);
+ mSocket = LLSocket::create(LLSocket::STREAM_TCP);
}
mConnected = mSocket->blockingConnect(mDaemonHost);
diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp
index 1694126802..d982ca5020 100644
--- a/indra/newview/llwatchdog.cpp
+++ b/indra/newview/llwatchdog.cpp
@@ -178,8 +178,8 @@ void LLWatchdog::init(killer_event_callback func)
mKillerCallback = func;
if(!mSuspectsAccessMutex && !mTimer)
{
- mSuspectsAccessMutex = new LLMutex(NULL);
- mTimer = new LLWatchdogTimerThread();
+ mSuspectsAccessMutex = new LLMutex;
+ mTimer = new LLWatchdogTimerThread;
mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000);
mLastClockCount = LLTimer::getTotalTime();
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 4a6ec7fdbb..a7ae456f3c 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -127,6 +127,12 @@ void LLWorld::destroyClass()
LLVOCache::getInstance()->destroyClass() ;
}
LLViewerPartSim::getInstance()->destroyClass();
+
+ mDefaultWaterTexturep = NULL ;
+ for (S32 i = 0; i < 8; i++)
+ {
+ mEdgeWaterObjects[i] = NULL;
+ }
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index e74bf2a620..a335ec10bf 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -103,6 +103,7 @@
#include "llmutelist.h"
#include "lltoolpie.h"
#include "llcurl.h"
+#include "llnotifications.h"
void check_stack_depth(S32 stack_depth)
@@ -317,6 +318,7 @@ BOOL LLPipeline::sRenderFrameTest = FALSE;
BOOL LLPipeline::sRenderAttachedLights = TRUE;
BOOL LLPipeline::sRenderAttachedParticles = TRUE;
BOOL LLPipeline::sRenderDeferred = FALSE;
+BOOL LLPipeline::sMemAllocationThrottled = FALSE;
S32 LLPipeline::sVisibleLightCount = 0;
F32 LLPipeline::sMinRenderSize = 0.f;
@@ -561,6 +563,24 @@ void LLPipeline::destroyGL()
static LLFastTimer::DeclareTimer FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture");
+//static
+void LLPipeline::throttleNewMemoryAllocation(BOOL disable)
+{
+ if(sMemAllocationThrottled != disable)
+ {
+ sMemAllocationThrottled = disable ;
+
+ if(sMemAllocationThrottled)
+ {
+ //send out notification
+ LLNotification::Params params("LowMemory");
+ LLNotifications::instance().add(params);
+
+ //release some memory.
+ }
+ }
+}
+
void LLPipeline::resizeScreenTexture()
{
LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index e9da25e544..7f76211f1c 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -360,6 +360,8 @@ public:
static void updateRenderDeferred();
static void refreshRenderDeferred();
+ static void throttleNewMemoryAllocation(BOOL disable);
+
void addDebugBlip(const LLVector3& position, const LLColor4& color);
private:
@@ -515,8 +517,9 @@ public:
static BOOL sRenderAttachedLights;
static BOOL sRenderAttachedParticles;
static BOOL sRenderDeferred;
+ static BOOL sMemAllocationThrottled;
static S32 sVisibleLightCount;
- static F32 sMinRenderSize;
+ static F32 sMinRenderSize;
//screen texture
U32 mScreenWidth;
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 317c6fe9ac..aef145260b 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2147,6 +2147,16 @@
function="ToggleControl"
parameter="DebugShowMemory" />
</menu_item_check>
+ <menu_item_check
+ label="Show Private Mem Info"
+ name="Show Private Mem Info">
+ <menu_item_check.on_check
+ function="CheckControl"
+ parameter="DebugShowPrivateMem" />
+ <menu_item_check.on_click
+ function="ToggleControl"
+ parameter="DebugShowPrivateMem" />
+ </menu_item_check>
<menu_item_separator/>
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 661165069e..8a076aaf19 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -7125,6 +7125,20 @@ Click and drag anywhere on the world to rotate your view
<tag>funds</tag>
</notification>
+ <notification
+ icon="alertmodal.tga"
+ name="LowMemory"
+ type="alertmodal">
+ Your memory pool is low. Some functions of SL are disabled to avoid crash. Please close other applications. Restart SL if this persists.
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="ForceQuitDueToLowMemory"
+ type="alertmodal">
+ SL will quit in 30 seconds due to out of memory.
+ </notification>
+
<notification
name="PopupAttempt"
icon="Popup_Caution"
diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp
index acc6e814bc..102294959a 100644
--- a/indra/newview/tests/llworldmap_test.cpp
+++ b/indra/newview/tests/llworldmap_test.cpp
@@ -27,7 +27,6 @@
// Dependencies
#include "linden_common.h"
-#include "llapr.h"
#include "llsingleton.h"
#include "lltrans.h"
#include "lluistring.h"