File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -317,8 +317,14 @@ function decreaseBufferPool () {
317
317
if ( bufferPool . length > 50 * 1024 ) {
318
318
// Balance between increasing and decreasing the bufferPool
319
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 )
320
+ // Decrease the bufferPool by 10% by removing the first 10% of the current pool
321
+ 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 )
322
328
} else {
323
329
notDecreased ++
324
330
counter --
You can’t perform that action at this time.
0 commit comments