From bc16400ef24de71859a2bea85fbe5f94f4a922b0 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sun, 8 Jan 2012 10:24:09 +0000 Subject: [PATCH] Cleared some temporary variables after use To reduce memory consumption --- js/JavaScriptParseTree.js | 4 +++- js/WikiTextParseTree.js | 4 +++- js/WikiTextParser.js | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/js/JavaScriptParseTree.js b/js/JavaScriptParseTree.js index 0a066878b..a86f3831a 100644 --- a/js/JavaScriptParseTree.js +++ b/js/JavaScriptParseTree.js @@ -29,7 +29,9 @@ var JavaScriptParseTree = function(tree) { JavaScriptParseTree.prototype.render = function() { this.output = []; this.renderSubTree(this.tree); - return this.output.join(""); + var r = this.output.join(""); + this.output = null; + return r; }; // Render a subtree of the parse tree to an array of fragments of JavaScript source code diff --git a/js/WikiTextParseTree.js b/js/WikiTextParseTree.js index a8b05d461..bf9f1905d 100644 --- a/js/WikiTextParseTree.js +++ b/js/WikiTextParseTree.js @@ -61,7 +61,9 @@ WikiTextParseTree.prototype.compile = function(type,treenode) { ] } ]); - return parseTree.render(); + var r = parseTree.render(); + this.output = null; + return r; }; WikiTextParseTree.prototype.pushString = function(s) { diff --git a/js/WikiTextParser.js b/js/WikiTextParser.js index d527d7e97..8fc8002ae 100644 --- a/js/WikiTextParser.js +++ b/js/WikiTextParser.js @@ -47,7 +47,10 @@ WikiTextParser.prototype.parse = function(text) { this.dependencies = []; this.output = null; this.subWikify(this.children); - return new WikiTextParseTree(this.children,this.dependencies,this.store); + var tree = new WikiTextParseTree(this.children,this.dependencies,this.store); + this.source = null; + this.children = null; + return tree; }; WikiTextParser.prototype.addDependency = function(dependency) {