浏览代码

Fixed a leak with console stack in the interpreter.

Issue was pushing a new frame in the global scope. Everytime a global scope was called, 1 ConsoleValue got allocated that was never freed. After 4096 'global scope' function calls, the engine would blow. Also cleans up an extra rogue usage of push/pop with the saver helper.
Jeff Hutchinson 3 年之前
父节点
当前提交
7ac62f42a3
共有 2 个文件被更改,包括 2 次插入3 次删除
  1. 0 1
      Engine/source/console/compiledEval.cpp
  2. 2 2
      Engine/source/console/console.cpp

+ 0 - 1
Engine/source/console/compiledEval.cpp

@@ -696,7 +696,6 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
       {
          // argc is the local count for eval
          gEvalState.pushFrame(NULL, NULL, argc);
-         gCallStack.pushFrame(0);
          popFrame = true;
       }
       else

+ 2 - 2
Engine/source/console/console.cpp

@@ -1628,9 +1628,9 @@ static ConsoleValue _internalExecute(SimObject *object, S32 argc, ConsoleValue a
       ICallMethod *com = dynamic_cast<ICallMethod *>(object);
       if(com)
       {
-         gCallStack.pushFrame(0);
+         ConsoleStackFrameSaver saver;
+         saver.save();
          com->callMethodArgList(argc, argv, false);
-         gCallStack.popFrame();
       }
    }