"Cannot enlarge memory arrays" error when document is big.
See original GitHub issueOS: MacOS 10.13.6
React-pdf version: 1.0.0-alpha.17
Description: Hello! I’m using react-pdf to generate payment reports for a website I’m working on. The reports can often get really big, 400+ pages long. But I can only generate about 450 pages on my machine. If I try to render more, it hangs and finally crashes with the following error:
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 134217728, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
I’m rendering the pdf reports in browser with PDFViewer.
How to replicate issue including code snippet (if applies):
I made a reproducible demo here (almost same code as in pageWrap example but rendering the same Don Quijote page content 1600 times): https://github.com/binchik/react-pdf-crash-example
It loads for about 5-10 minutes then crashes with the “Cannot enlarge memory arrays” error.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:28 (2 by maintainers)
Top Results From Across the Web
Cannot enlarge memory arrays when allocating 1Mbytes buffer
"Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with ALLOW_MEMORY_GROWTH ...
Read more >Cannot Enlarge Memory Arrays Browser error - Unity Forum
Hello, I created a WebGL app, and ran it in a browser, then i got the error Cannot enlarge memory arrays. Either (1)...
Read more >Why can't I decode a too heavy bpg image in my browser?
The error message tells you what is wrong and what you can do about it: "Cannot enlarge memory arrays. Either (1) compile with...
Read more >Endless Sky Deps / Thomas Ballinger / Observable
What I see here are the all-too-familiar Emscripten memory errors. abort("Cannot enlarge memory arrays. ... Error: Unable to load file: image@2.png.
Read more >How can I solve this problem? "Cannot enlarge memory arrays."
I have this error when I try to launch my unity game in the browser. 1.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok. I just discovered that My Issue is a little different. I have a View that has wrap=false. The problem is that the view contains dynamic content. when the content grows to a point that is bigger than can fit on a page, then I am guessing react-pdf keeps wrapping the whole view to the next page, hoping that the view will fit on the next page, until finally it has generated XXX number of pages and then runs out of memory.
When wrap=true, the the view contents are split, which might be ok, except when it wraps, the first part of the View contents get compressed together. as seen in this picture.
I should probably create a separate issue for this.
experiencing the same behavior for large documents.