Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Unable to print large documents in Electron 4, 5 #16813
When printing a large document, every page should print successfully.
When printing a large document, printing fails before completing, or produces a run of blank pages at the end. Given the number of pages involved, 800+, this has only been tested through print-to-file drivers such as Microsoft Print to PDF, and Microsoft XPS Document Writer.
This appears to be memory-related, as memory usage climbs for each additional page spooled. Prior versions of Electron did not exhibit increasing memory usage during page spooling.
This issue was first observed in a PDF.js-based viewer embedded in our application. I have created a simple application that emulates PDF.js printing behavior, here:
The README contains details of the testing that I have conducted.
I've reproduced this with a video showing what happens with windows memory as it creeps up to the 64 gb VMemory limit on my machine and then fails near ~2200 pages out of 2500 using the test app @justin-elliott provided. I also show Resource monitor live monitoring during the process showing electron consuming ungodly amounts of memory (50 + GB) before everything falls over.
Note that the output PDF is 0kb / blank in this case, as the print spooling process (which seems to be running under electron's memory footprint) just seems to fall over.
I also show that windows event viewer triggers a resource exhaustion warning, which may relate to why the process ultimately terminates. Clearly , though this is some sort of memory leak/bloat that didn't exist before.