From 97cc06a7f95ea6c25c6699b85a6f746b3ca00cba Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 12 Jun 2014 16:20:30 +1000 Subject: [PATCH] Zero the height and width of the PageView canvas before deleting. --- web/page_view.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/page_view.js b/web/page_view.js index 47b18d7d3..d90419e55 100644 --- a/web/page_view.js +++ b/web/page_view.js @@ -99,7 +99,13 @@ var PageView = function pageView(container, id, scale, this.annotationLayer = null; } - delete this.canvas; + if (this.canvas) { + // Zeroing the width and height causes Firefox to release graphics + // resources immediately, which can greatly reduce memory consumption. + this.canvas.width = 0; + this.canvas.height = 0; + delete this.canvas; + } this.loadingIconDiv = document.createElement('div'); this.loadingIconDiv.className = 'loadingIcon';