1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Slightly increase the maximum image sizes that we'll cache

The current value originated in PR 2317, and in the decade that have passed the amount of RAM available in (most) devices should have increased a fair bit.
Nowadays we also do a much better job of detecting repeated images at both the page- and document-level, which helps reduce overall memory-usage in many documents.

Finally the constant is also moved into the `src/shared/util.js` file, since it was implicitly used on both the main- and worker-thread previously.
This commit is contained in:
Jonas Jenwald 2023-03-04 11:22:59 +01:00
parent 15d9faba57
commit c0671ac133
3 changed files with 13 additions and 4 deletions

View file

@ -13,7 +13,13 @@
* limitations under the License.
*/
import { assert, shadow, unreachable, warn } from "../shared/util.js";
import {
assert,
MAX_IMAGE_SIZE_TO_CACHE,
shadow,
unreachable,
warn,
} from "../shared/util.js";
import { RefSetCache } from "./primitives.js";
class BaseLocalCache {
@ -160,7 +166,7 @@ class GlobalImageCache {
}
static get MAX_BYTE_SIZE() {
return shadow(this, "MAX_BYTE_SIZE", /* Forty megabytes = */ 40e6);
return shadow(this, "MAX_BYTE_SIZE", 5 * MAX_IMAGE_SIZE_TO_CACHE);
}
constructor() {