Skip to content

Commit

Permalink
refactor(tokenizer): Use explicit empty buffer if we have reached the…
Browse files Browse the repository at this point in the history
… end

Ensures we don't keep any slices in memory (independent of the JS engine)
  • Loading branch information
fb55 committed Aug 27, 2021
1 parent 78af88d commit 9c30fe6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Tokenizer.ts
Expand Up @@ -833,7 +833,8 @@ export default class Tokenizer {
}

const start = this.sectionStart < 0 ? this._index : this.sectionStart;
this.buffer = this.buffer.substr(start);
this.buffer =
start === this.buffer.length ? "" : this.buffer.substr(start);
this._index -= start;
this.bufferOffset += start;

Expand Down

0 comments on commit 9c30fe6

Please sign in to comment.