question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak with render mode svg

See original GitHub issue

Before 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
github-actions[bot]commented, May 30, 2022

This issue was closed because it has been stalled for 14 days with no activity.

0reactions
github-actions[bot]commented, May 9, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found