[api-minor] Attempt to reduce memory usage during printing, by always running cleanup once rendering has finished

Given that `cleanupAfterRender` is already set for large images, when handling 'obj' messages, this patch *should* thus be safe in general (since otherwise there ought be existing bugs related to cleanup and printing).
This commit is contained in:
Jonas Jenwald 2019-06-02 22:18:21 +02:00
parent 63014eb897
commit 625af8d2ad

View File

@ -1004,7 +1004,7 @@ class PDFPageProxy {
const stats = this._stats;
stats.time('Overall');
// If there was a pending destroy cancel it so no cleanup happens during
// If there was a pending destroy, cancel it so no cleanup happens during
// this call to render.
this.pendingCleanup = false;
@ -1044,7 +1044,9 @@ class PDFPageProxy {
intentState.renderTasks.splice(i, 1);
}
if (this.cleanupAfterRender) {
// Attempt to reduce memory usage during *printing*, by always running
// cleanup once rendering has finished (regardless of cleanupAfterRender).
if (this.cleanupAfterRender || renderingIntent === 'print') {
this.pendingCleanup = true;
}
this._tryCleanup();