Memory leak with render mode svg
See original GitHub issueBefore you start - checklist
- I followed instructions in documentation written for my React-PDF version
- I have checked if this bug is not already reported
- I have checked if an issue is not listed in Known issues
- If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo
Description
Memory leak when render a PDF with 14 pages with render mode svg. Rendering consume at least 500/600 Mo of memory.
This is not the case with canvas default mode.
My react app crush on mobile when adding two document to render this PDF.
Steps to reproduce
```
<Document className=“d-flex flex-column align-items-center” file={path} options={{ cMapUrl: ‘cmaps/’, cMapPacked: true, }} onLoadSuccess={onDocumentLoadSuccess} loading={‘Chargement’} error={‘Erreur de chargement’} > {Array.from(Array(numPages)) .map((x, i) => i + 1) .map((page) => ( <Page data-testid=“pageidtest” renderMode={‘svg’} renderTextLayer={false} className=“stuff” key={page} pageNumber={page} ></Page> ))} </Document>
### Expected behavior
Rendering PDF with a high number of pages and svg mode should not cause a memory leak or crash on mobile side.
### Actual behavior
Rendering PDF with a high number of page and svg mode cause a memoty lean on desktop and crush on mobile.
### Additional information
_No response_
### Environment
Browser (if applicable): Chrome 96, Firefox 94
React-PDF version: 5.6.0
React version: 17.0.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Memory leak in React when using HTML5 Canvas
The render function gets the "2d" context from the canvas a few times, gets image data with ctx.createImageData , and sets image data...
Read more >Memory leak caused by using SVG in UA stylesheet
My CL [1], which is using background-image:url(data:image/svg+xml) in UA stylesheet, is causing a memory leak detected by chromium.memory/WebKit Linux Leak ...
Read more >memory - Firefox: Viewing a specific SVG file turns the system ...
Go to about:support in Firefox, click "Copy text to clipboard", and post that here (pastebin or so). · Go to about:memory in Firefox,...
Read more >memory leak with chrome://browser/skin/tabbrowser/loading ...
Summary: memory leak when repeatly open and close same single page → memory leak with chrome://browser/skin/tabbrowser/loading-burst.svg when repeatly open ...
Read more >Regression - Sad tab after SVG transformation (memory leak?)
Issue 278488: Regression - Sad tab after SVG transformation (memory leak?) ... Possible memory leak, see the symptoms described below. ... 4. When...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue was closed because it has been stalled for 14 days with no activity.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.