Open timovandeput opened 2 years ago
Describe the bug The browser page crashes after opening a PDF and rendering a single page some 100 times.
To Reproduce This code consistently crashes between iteration 80 and 100 on my MacBook Pro for a (mixed text and image) file of 150k bytes:
Future<void> render(int times) async { for (var i = 1; i <= times; i++) { try { print('Rendering $i'); final document = await PdfDocument.openData(_fileBuffer!); final page = await document.getPage(1); await page.render(width: page.width, height: page.height); await page.close(); await document.close(); } catch (e) { print('Exception on render $i: $e'); } } }
Expected behaviour Render infinitely without crashing :-)
Environment
Additional context (none)
It looks the problem is caused by a resource leak in opening / closing the PDF document, as rendering many pages without closing and reopening the document does work.
Describe the bug The browser page crashes after opening a PDF and rendering a single page some 100 times.
To Reproduce This code consistently crashes between iteration 80 and 100 on my MacBook Pro for a (mixed text and image) file of 150k bytes:
Expected behaviour Render infinitely without crashing :-)
Environment
Additional context (none)