Browse Source

Resolved severe memory leak (mozPrintCallback)

Do NOT save the temporary <canvas> element as `this.canvas`.
`PDFViewer.pages[i].canvas` appears to be used to generate the thumbnail
icons. Well, that's no justification for preventing GC of those
temporary <canvas> elements used during mozPrintCallback.

With a document consisting of 79 pages, this resulted in a 600-700MB
leaked memory.
Rob Wu 12 years ago
parent
commit
194a734e5d
  1. 2
      web/page_view.js

2
web/page_view.js

@ -514,7 +514,7 @@ var PageView = function pageView(container, id, scale, @@ -514,7 +514,7 @@ var PageView = function pageView(container, id, scale,
// Use the same hack we use for high dpi displays for printing to get better
// output until bug 811002 is fixed in FF.
var PRINT_OUTPUT_SCALE = 2;
var canvas = this.canvas = document.createElement('canvas');
var canvas = document.createElement('canvas');
canvas.width = Math.floor(viewport.width) * PRINT_OUTPUT_SCALE;
canvas.height = Math.floor(viewport.height) * PRINT_OUTPUT_SCALE;
canvas.style.width = (PRINT_OUTPUT_SCALE * viewport.width) + 'pt';

Loading…
Cancel
Save