浏览代码

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

Azaezel 10 年之前
父节点
当前提交
a4c09d1680
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      Engine/source/platform/profiler.cpp

+ 6 - 3
Engine/source/platform/profiler.cpp

@@ -212,11 +212,14 @@ Profiler::~Profiler()
 void Profiler::reset()
 void Profiler::reset()
 {
 {
    mEnabled = false; // in case we're in a profiler call.
    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)
    for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
    {
    {
       walk->mFirstProfilerData = 0;
       walk->mFirstProfilerData = 0;