Hello @diegomura
the module suggests it should not be used in Production. What does it exactly implies??
I tried deploying it on AWS, machine using docker container. Now the problem I face is: I observe on each pdf generation it tends to acquire around 70-80mbs of memory and doesn't release even after pdf generation is over and this process goes on.
Can you please suggest, if the module has an issue or I am missing something here??
Sorry I didn't respond sooner. Is this still happening?
This is very hard to debug, and I'll need to set up or an AWS machine, or figure out something else.
However, there are points that I think more probably to be the cause of this:
Seems like it definitely is:

After 35 renders I have 35 PDFDocument instances in memory, responsible for 85% of the memory in use by the service.
I think there is a problem in yoga which is called from measureText in Text.js
I tried ading the master branch of yoga-layout to the project and retesting it with that one, but that produces a very identical result.
We have now "solved" the issue by letting pm2 issue restarts, but of course that is not the best way to go
馃 Interesting.
Maybe if we call layout.destroy() on each node (or in the upper node) after the document is closed? Maybe that will free that memory
@diegomura yes File I/O, and yoga both were leaking memory for me and I used a precompiled version, and also closed the open filestream objects.
It did fix memory leakage for me but as @rogierslag pointed out it does keep pdfs in memory and thats what takes a major part.
@rogierslag Funny, thats how I too tried to solve the issue.
The memory leak exists in pdfkit, see https://github.com/devongovett/pdfkit/issues/728. There is an open PR in pdfkit to fix this, but is not merged.
Closing this. react-pdf currently uses own pdfkit fork, and no new memory issues were reported ever since.
Most helpful comment
The memory leak exists in pdfkit, see https://github.com/devongovett/pdfkit/issues/728. There is an open PR in pdfkit to fix this, but is not merged.