Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Describe the bug
Trying to build my project and it always fails with the error FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory. If I am running just the client, it runs fine, but when I try to build with server (starting with a mvn clean install) it gives me this fatal error.
The PDF itself is only 1 page. Dynamic PDF (props passed in). Rendering the PDF via <BlobProvider /> then taking the URL to open in a new page.
So I don't really know where to even start with the debugging. I've tried to follow other issues/threads in this forum about this topic but haven't found a single solution.
Example Simplified Snippet
//Clicking on this button, makes an API call. The data is then stored in a state.
<Button onClick={() => fetchData()}>
Download
</Button>
//Once the state is stored, then get the URL and open it in a new tab for viewing/downloading
{Object.values(data).length > 0 && (
<BlobProvider
document={
<PDF data={data} />
}
>
{({ url, loading }) => {
return loading ? null : openPDFNewTab(url);
}}
</BlobProvider>
)}
Expected behavior Should be able to build this project with the the react-pdf/renderer library
Desktop (please complete the following information):
- OS: MacOS
- Browser: Chrome
- React-pdf version: 1.6.9
Last version fixes this. Thanks!
@diegomura we are still getting these on Version 3.0.3 we cannot use Latest Version also as it throw exception of function not found in typescript
<--- Last few GCs --->
[12884:000001B1BD954080] 188846 ms: Scavenge (reduce) 2039.1 (2050.1) -> 2038.2 (2051.1) MB, 2.6 / 0.0 ms (average mu = 0.075, current
mu = 0.019) allocation failure
[12884:000001B1BD954080] 188852 ms: Scavenge (reduce) 2039.1 (2053.1) -> 2038.3 (2053.6) MB, 2.9 / 0.0 ms (average mu = 0.075, current
mu = 0.019) allocation failure
<--- JS stacktrace --->
@diegomura @anwarjaved any solution for this?