question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Cannot enlarge memory arrays" error when document is big.

See original GitHub issue

OS: 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
AirborneEaglecommented, Dec 6, 2018

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. image

I should probably create a separate issue for this.

8reactions
sabin-pandeycommented, Jul 21, 2020

Same problem here. Rendering a large amount of views and texts to display data tables. After about 25 pages, it crashes.

experiencing the same behavior for large documents.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found