Skip to content

Commit bd5cc64

Browse files
committed
Merge pull request #752 from dohse/fix-queue-leak
Allow garbage collection of processed queue items
2 parents b1e51c8 + 3b6ab9e commit bd5cc64

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
@@ -20,7 +20,10 @@ Queue.prototype.shift = function () {
2020
return;
2121
}
2222
}
23-
return this.head[this.offset++]; // sorry, JSLint
23+
var item = this.head[this.offset];
24+
this.head[this.offset] = null;
25+
this.offset++;
26+
return item;
2427
};
2528

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

0 commit comments

Comments
 (0)