summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStinson Linden <stinson@lindenlab.com>2014-04-23 01:57:24 +0100
committerStinson Linden <stinson@lindenlab.com>2014-04-23 01:57:24 +0100
commit041f267d6a5a4c6251a113accdf0003301beb6a9 (patch)
treece1db040e6a2f36fefded5d813d64c0604fcf213
parentd0ef02c23a7a37c8c9bfe3a86bae88bb811fc9fe (diff)
MAINT-4009: Adding LLWinDebug::cleanup() to ensure memory is freed at app end.
-rw-r--r--indra/newview/llappviewerwin32.cpp4
-rwxr-xr-xindra/newview/llwindebug.cpp20
-rwxr-xr-xindra/newview/llwindebug.h1
3 files changed, 20 insertions, 5 deletions
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 06f081e920..a1b4fd1035 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -542,6 +542,10 @@ bool LLAppViewerWin32::cleanup()
gDXHardware.cleanup();
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+ LLWinDebug::instance().cleanup();
+#endif
+
return result;
}
diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp
index 551d0be8d7..eff70ca0b2 100755
--- a/indra/newview/llwindebug.cpp
+++ b/indra/newview/llwindebug.cpp
@@ -45,7 +45,7 @@ public:
~LLMemoryReserve();
void reserve();
void release();
-protected:
+private:
unsigned char *mReserve;
static const size_t MEMORY_RESERVATION_SIZE;
};
@@ -53,7 +53,7 @@ protected:
LLMemoryReserve::LLMemoryReserve() :
mReserve(NULL)
{
-};
+}
LLMemoryReserve::~LLMemoryReserve()
{
@@ -66,14 +66,19 @@ const size_t LLMemoryReserve::MEMORY_RESERVATION_SIZE = 5 * 1024 * 1024;
void LLMemoryReserve::reserve()
{
if(NULL == mReserve)
+ {
mReserve = new unsigned char[MEMORY_RESERVATION_SIZE];
-};
+ }
+}
void LLMemoryReserve::release()
{
- delete [] mReserve;
+ if (NULL != mReserve)
+ {
+ delete [] mReserve;
+ }
mReserve = NULL;
-};
+}
static LLMemoryReserve gEmergencyMemoryReserve;
@@ -130,6 +135,11 @@ void LLWinDebug::init()
}
}
+void LLWinDebug::cleanup ()
+{
+ gEmergencyMemoryReserve.release();
+}
+
void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename)
{
// Temporary fix to switch out the code that writes the DMP file.
diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h
index 6f274c6f16..a3cbf6dc03 100755
--- a/indra/newview/llwindebug.h
+++ b/indra/newview/llwindebug.h
@@ -37,6 +37,7 @@ class LLWinDebug:
public:
static void init();
static void generateMinidump(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL);
+ static void cleanup();
private:
static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename);
};