mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Ensure that the Cmd
/Name
/Ref
caches are cleared when running other cleanup
code
The purpose of these caches is to reduce peak memory usage, by only ever having *a single* instance of a particular object. However, as-is these caches are never cleared and they will thus remain until the worker is destroyed. This could very well have a negative effect on total memory usage, particularly for large/long documents, hence it seems to make sense to clear out these caches together with various other ones.
This commit is contained in:
parent
9ab1d9f596
commit
5e045bcdba
2 changed files with 27 additions and 7 deletions
|
@ -20,8 +20,8 @@ import {
|
|||
warn
|
||||
} from '../shared/util';
|
||||
import {
|
||||
Dict, isCmd, isDict, isName, isRef, isRefsEqual, isStream, Ref, RefSet,
|
||||
RefSetCache
|
||||
clearPrimitiveCaches, Dict, isCmd, isDict, isName, isRef, isRefsEqual,
|
||||
isStream, Ref, RefSet, RefSetCache
|
||||
} from './primitives';
|
||||
import { Lexer, Parser } from './parser';
|
||||
import {
|
||||
|
@ -662,6 +662,7 @@ class Catalog {
|
|||
}
|
||||
|
||||
cleanup() {
|
||||
clearPrimitiveCaches();
|
||||
this.pageKidsCountCache.clear();
|
||||
|
||||
const promises = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue