Skip to content

Commit fcf170d

Browse files
committed
Set buffer entries to undefined on clear()
1 parent e8a5e07 commit fcf170d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/queue.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export class Queue<T> {
5555
}
5656

5757
clear() {
58+
for (let i = 0; i < this._size; i++) {
59+
this.buffer[(this.head + i) % this._size] = undefined
60+
}
61+
5862
this.head = 0
5963
this.tail = 0
6064
this._size = 0

0 commit comments

Comments
 (0)