aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-29 17:23:32 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-29 17:23:32 -0800
commitff7d01a6a846dd9a976dc7e3c585b074def23497 (patch)
tree1e666a7a41d664f4799630a652a6a8ba46e95665
parentf8c5d678ecd79b4e81c82f7e847f5cf6d6007f34 (diff)
more memory debugging stuff, and a disabled option to throttle the framework inbox
-rw-r--r--src/framework.js14
-rw-r--r--src/intertyper.js1
2 files changed, 12 insertions, 3 deletions
diff --git a/src/framework.js b/src/framework.js
index 6e2bbe81..d830599d 100644
--- a/src/framework.js
+++ b/src/framework.js
@@ -22,6 +22,7 @@ var MemoryDebugger = {
MemoryDebugger.datas = {};
var info = MemoryDebugger.doGC();
MemoryDebugger.last = info[2];
+ MemoryDebugger.max = 0;
MemoryDebugger.tick('--clear--');
},
@@ -44,6 +45,7 @@ var MemoryDebugger = {
var info = MemoryDebugger.doGC();
var before = info[1];
var after = info[2];
+ MemoryDebugger.max = Math.max(MemoryDebugger.max, before, after);
// A GC not called by us may have done some work 'silently'
var garbage = before - after;
var real = after - MemoryDebugger.last;
@@ -70,6 +72,7 @@ var MemoryDebugger = {
dump: function() {
var vals = values(MemoryDebugger.datas);
+ print('zz max: ' + (MemoryDebugger.max/(1024*1024)).toFixed(3));
print('zz real:');
vals.sort(function(x, y) { return y.real - x.real });
vals.forEach(function(v) { if (Math.abs(v.real) > 1024*1024) print('zz ' + v.name + ' real = ' + (v.real/(1024*1024)).toFixed(3) + ' mb'); });
@@ -115,8 +118,15 @@ Substrate.prototype = {
this.currUid ++;
}
}
- actor.inbox = [];
- actor.items = actor.items.concat(items);
+ var MAX_INCOMING = Infinity;
+ if (MAX_INCOMING == Infinity) {
+ actor.inbox = [];
+ actor.items = actor.items.concat(items);
+ } else {
+ throw 'Warning: Enter this code at your own risk. It can save memory, but often regresses speed.';
+ actor.inbox = items.slice(MAX_INCOMING);
+ actor.items = actor.items.concat(items.slice(0, MAX_INCOMING));
+ }
},
addActor: function(name_, actor) {
diff --git a/src/intertyper.js b/src/intertyper.js
index 60b560b3..8e7187b6 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -339,7 +339,6 @@ function intertyper(data, parseFunctions, baseLineNum) {
substrate.addActor('Global', {
processItem: function(item) {
function scanConst(value, type) {
- //dprint('inter-const: ' + item.lineNum + ' : ' + JSON.stringify(value) + ',' + type + '\n');
Types.needAnalysis[type] = 0;
if (Runtime.isNumberType(type) || pointingLevels(type) >= 1) {
return { value: toNiceIdent(value.text), type: type };