From a4c09d168029dccac872b5816b21f8298f73f5e9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 1 Jun 2015 23:45:49 -0500 Subject: [PATCH 1/2] leak prevention according to: https://vld.codeplex.com/ apparently we weren't freeing the entirety of the ProfilerData linked list when resetting the Profiler, and that was leading to a pinhole leak per profiled block --- Engine/source/platform/profiler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index 8284ffb34..ae35035f7 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -212,11 +212,14 @@ Profiler::~Profiler() void Profiler::reset() { mEnabled = false; // in case we're in a profiler call. - while(mProfileList) + ProfilerData * head = mProfileList; + ProfilerData * curr = NULL; + while ((curr = head) != NULL) { - free(mProfileList); - mProfileList = NULL; + head = head->mNextProfilerData; + free(curr); } + for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot) { walk->mFirstProfilerData = 0; From b1e8a45a4838bc6723552092a291da69f7202c4f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 2 Jun 2015 14:25:08 -0500 Subject: [PATCH 2/2] leak prevention according to: https://vld.codeplex.com/ ConsoleValue() constructors and destructors to handle corner-cases not already addressed via init, and cleanup --- Engine/source/console/console.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 8ca1b26b4..e38fb83a4 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -191,7 +191,7 @@ public: void cleanup() { - if (bufferLen > 0) + if ((type <= TypeInternalString) && (bufferLen > 0)) { dFree(sval); bufferLen = 0; @@ -201,6 +201,8 @@ public: ival = 0; fval = 0; } + ConsoleValue(){ init(); }; + ~ConsoleValue(){ cleanup(); }; }; // Proxy class for console variables