From: notmasteryet Date: Thu, 18 Aug 2011 12:43:45 +0000 (-0500) Subject: LZW reducing memory usage X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b7ac83da32110de6ea6af123a70a8a25362dec83;p=pdf.js.git LZW reducing memory usage --- diff --git a/pdf.js b/pdf.js index 2afed5f..eab5a35 100644 --- a/pdf.js +++ b/pdf.js @@ -1990,7 +1990,7 @@ var LZWStream = (function() { this.cachedData = 0; this.bitsCached = 0; - var maxLzwDictionarySize = 4097; + var maxLzwDictionarySize = 4096; var lzwState = { earlyChange: earlyChange, codeLength: 9, @@ -2036,6 +2036,9 @@ var LZWStream = (function() { var i, j, q; var lzwState = this.lzwState; + if (!lzwState) + return; // eof was found + var earlyChange = lzwState.earlyChange; var nextCode = lzwState.nextCode; var dictionaryValues = lzwState.dictionaryValues; @@ -2073,6 +2076,7 @@ var LZWStream = (function() { continue; } else { this.eof = true; + delete this.lzwState; break; }