mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Don't store page-level data, in the API, after cleanup has run (bug 1854145)
For large/complex images it's possible that the image-data arrives in the API *after* the page has been scrolled out-of-view and thus been cleaned-up. In this case we obviously shouldn't cache such page-level data, since it'll first of all be unused and secondly can increase memory usage *a lot*. Also, ensure that we *immediately* release any `ImageBitmap` data in this case to help reclaim memory faster.
This commit is contained in:
parent
2c39a739f5
commit
0238cf134d
1 changed files with 5 additions and 0 deletions
|
@ -2768,6 +2768,11 @@ class WorkerTransport {
|
|||
if (pageProxy.objs.has(id)) {
|
||||
return;
|
||||
}
|
||||
// Don't store data *after* cleanup has successfully run, see bug 1854145.
|
||||
if (pageProxy._intentStates.size === 0) {
|
||||
imageData?.bitmap?.close(); // Release any `ImageBitmap` data.
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "Image":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue