Skip to content

Commit 3b6ab9e

Browse files
author
Jonas Dohse
committed
Allow garbage collection of processed queue items
Set processed queue items to `null` to allow garbage collection of these items. The command queue contains callbacks. They contain the stack of the current fiber, which can be large. Allow earlier garbage collection of these stacks by removing the reference to the queue items.
1 parent a2ebe4f commit 3b6ab9e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/queue.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ Queue.prototype.shift = function () {
1818
return;
1919
}
2020
}
21-
return this.head[this.offset++]; // sorry, JSLint
21+
var item = this.head[this.offset];
22+
this.head[this.offset] = null;
23+
this.offset++;
24+
return item;
2225
};
2326

2427
Queue.prototype.push = function (item) {

0 commit comments

Comments
 (0)