aboutsummaryrefslogtreecommitdiff
path: root/src/framework.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-01 13:47:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-01 13:47:37 -0800
commit6b70b676ba4bdf317c2391e90c82d837b18e3849 (patch)
tree289553d5b7ba414840a6e4024dd48703cd56127f /src/framework.js
parent8794769222e617f5b35fb77973114d3d4a70dd14 (diff)
misc minor but important memory fixes
Diffstat (limited to 'src/framework.js')
-rw-r--r--src/framework.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/framework.js b/src/framework.js
index e83250f3..7adf43d3 100644
--- a/src/framework.js
+++ b/src/framework.js
@@ -185,7 +185,7 @@ Substrate.prototype = {
dprint('framework', 'New results: ' + (outputs.length + this.results.length - currResultCount) + ' out of ' + (this.results.length + outputs.length));
hadProcessing = true;
- if (outputs) {
+ if (outputs && outputs.length > 0) {
if (outputs.length === 1 && outputs[0].__finalResult__) {
if (DEBUG) print("Solving complete: __finalResult__");
delete outputs[0].__finalResult__; // Might recycle this
@@ -194,7 +194,6 @@ Substrate.prototype = {
finished = true;
finalResult = outputs[0];
} else {
- outputs.forEach(function(output) { delete output.tokens }); // clean up tokens to save memory
this.results = this.results.concat(outputs);
}
}
@@ -206,7 +205,8 @@ Substrate.prototype = {
delete result.__uid__; // Might recycle these
if (onResult) onResult(result);
});
- ret = this.results;
+ ret = this.results;
+ this.results = null; // No need to hold on to them any more
break;
}
if (finalResult) {
@@ -222,6 +222,8 @@ Substrate.prototype = {
actor.inbox = null;
});
+ if (DEBUG_MEMORY) MemoryDebugger.tick('finished ' + this.name_);
+
return ret;
}
};