Memory leak - Every time a PDF is generated, the memory used increases and never comes back down.
See original GitHub issueFirst, Thank you for the awesome work on this library!
Describe the bug We notice that rendering PDFs caused a memory leak in our prod environment. We dedicated some work to isulating the issue and it seems to be inside the react-pdf, because it only happens when we call it. There’s a chance I could be wrong but I havent been able to find anything else that causes this besides us calling the react-pdf library. While running react-pdf in a node server, Every time a PDF is rendered, the memory used by the app increases and never comes back down to what it was before the rendering occurred.
To Reproduce Steps to reproduce the behavior including code snippet (if applies):
- watch the memory used by your application that uses react-pdf.
- Notice how the memory used by the app increases when a PDF is rendered. and it never comes back down.
You can notice the difference better once you render over 50 or 75 documents.
HERE is a quick and easy way to reproduce it.
clone this project:
https://github.com/Osuriel/react-pdf-test
the readme.me has all the steps to run it and easily monitor it.
Expected behavior The memory should eventually go back to normal after a request is made and not increase continually.
Screenshots before rendering pdfs:
after rendering 100 pdfs, and waiting for a while:
Desktop (please complete the following information):
- OS: MacOS, Linux
-
"@react-pdf/renderer": "1.6.4"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:14
Top GitHub Comments
Still not working ²
I also have a problem, which is probably related to a memory leak. When I’m rendering document to the file for the first time - everything is ok. Any second and next attempt (for example, after changing the list of maped children in Page component) is unsuccesful - there is an error. Looks like the memory is not erased after first rendering.
I’m using v1.6.7.