diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.68k stars 1.17k forks source link

Memory leak in @react-pdf/renderer #2217

Open sachin717 opened 1 year ago

sachin717 commented 1 year ago

Gulp bundle --ship is not completing when we import package @react-pdf/renderer

To Reproduce Steps to reproduce the behavior including code snippet (if applies): 1.import { PDFDownloadLink } from '@react-pdf/renderer'; 2.<PDFDownloadLink document={ } fileName={"!23.pdf"}> <PrimaryButton text={"Print"} />

  1. See error
  2. [23:07:33] Finished subtask 'configure-webpack' after 1.1 s [23:07:33] Starting subtask 'webpack'...

<--- Last few GCs --->

[6908:00000249F3C4E440] 263541 ms: Mark-sweep 1295.4 (1447.7) -> 1286.3 (1450.7) MB, 1134.9 / 0.0 ms (average mu = 0.180, current mu = 0.062) allocation failure scavenge might not succeed [6908:00000249F3C4E440] 264631 ms: Mark-sweep 1299.2 (1451.7) -> 1288.4 (1454.7) MB, 1017.3 / 0.0 ms (average mu = 0.130, current mu = 0.067) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 000002C3B045C5C1]

Security context: 0x01626ff9e6e1 1: _walk [0000019B21557FC1] [C:\Users\nandi\source\repos\EDM-ALLChanges\node_modules\terser\dist\bundle.min.js:~1] [pc=000002C3B1E491BF](this=0x00848b017fd9 ,e=0x029774a1d591 ) 2: / anonymous / [0000029774A70D79] [C:\Users\nandi\source\repos\EDM-ALLChanges\node_modules\terser\dist\b...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF6FDA1ECF5 2: 00007FF6FD9F81A6 3: 00007FF6FD9F8BB0 4: 00007FF6FDC89AAE 5: 00007FF6FDC899DF 6: 00007FF6FE1C7724 7: 00007FF6FE1BDE87 8: 00007FF6FE1BC3FC 9: 00007FF6FE1C5377 10: 00007FF6FE1C53F6 11: 00007FF6FDD684B7 12: 00007FF6FDE0019A 13: 000002C3B045C5C1

You can make use of react-pdf REPL to share the snippet

Expected behavior Webpack bundle should be complete without missing

Screenshots image

Desktop (please complete the following information):

jeetiss commented 1 year ago

this is a terser problem, not react-pdf as described in the error message

Security context: 0x01626ff9e6e1 1: _walk [0000019B21557FC1] [C:\Users\nandi\source\repos\EDM-ALLChanges\node_modules\terser\dist\bundle.min.js:~1] [pc=000002C3B1E491BF](this=0x00848b017fd9 ,e=0x029774a1d591 ) 2: / anonymous / [0000029774A70D79] [C:\Users\nandi\source\repos\EDM-ALLChanges\node_modules\terser\dist\b...

sachin717 commented 1 year ago

i had tried to bundle without pdf-renderer and its working fine

sachin717 commented 1 year ago

@jeetiss can you help which version of @rect-pdf/renderer suits best with Node 10.14.0 & React 16.8.5

sachin717 commented 1 year ago

can anyone help which version of react suits best with @react-pdf/renderer