We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a89bee commit 7860f67Copy full SHA for 7860f67
1 file changed
lib/parser.js
@@ -317,8 +317,14 @@ function decreaseBufferPool () {
317
if (bufferPool.length > 50 * 1024) {
318
// Balance between increasing and decreasing the bufferPool
319
if (counter === 1 || notDecreased > counter * 2) {
320
- // Decrease the bufferPool by 16kb by removing the first 16kb of the current pool
321
- bufferPool = bufferPool.slice(Math.floor(bufferPool.length / 10), bufferPool.length)
+ // Decrease the bufferPool by 10% by removing the first 10% of the current pool
+ var sliceLength = Math.floor(bufferPool.length / 10)
322
+ if (bufferOffset <= sliceLength) {
323
+ bufferOffset = 0
324
+ } else {
325
+ bufferOffset -= sliceLength
326
+ }
327
+ bufferPool = bufferPool.slice(sliceLength, bufferPool.length)
328
} else {
329
notDecreased++
330
counter--
0 commit comments