charto / nbind

:sparkles: Magical headers that make your C++ library accessible from JavaScript :rocket:
MIT License
1.98k stars 120 forks source link

"Cannot enlarge memory arrays" #122

Open ghost opened 5 years ago

ghost commented 5 years ago

Running on Windows 10 with WSL (Ubuntu 18.04). Using Webpack 4.25.1, in a React/Django application. Occurs while generating large PDF's using @react-pdf/renderer (https://github.com/diegomura/react-pdf).

Anyway, I get the following error which pointed me to this library which appears to be a dependency of yoga. which is a dependency of @react-pdf. It occurs in lines 98 and 100 of nbind.js.

:8000/results/#basic_query:1 
Uncaught (in promise) abort("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 ") at Error
    at jsStackTrace (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:444:15)
    at stackTrace (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:454:14)
    at abort (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:9809:182)
    at abortOnCannotGrowMemory (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:458:5)
    at enlargeMemory (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:460:5)
    at FC (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:9629:49)
    at oB (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:8462:17)
    at Ub (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:1833:31)
    at Wb (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:1842:14)
    at rf (webpack:////mnt/c/Users/User/projects/current/clientapp/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js?:3286:39)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
Promise.catch (async)
onDocumentUpdate @ react-pdf.browser.es.js:4858
componentDidMount @ react-pdf.browser.es.js:4838
commitLifeCycles @ react-dom.development.js:15961
commitAllLifeCycles @ react-dom.development.js:17262
callCallback @ react-dom.development.js:149
invokeGuardedCallbackDev @ react-dom.development.js:199
invokeGuardedCallback @ react-dom.development.js:256
commitRoot @ react-dom.development.js:17458
completeRoot @ react-dom.development.js:18912
performWorkOnRoot @ react-dom.development.js:18841
performWork @ react-dom.development.js:18749
performSyncWork @ react-dom.development.js:18723
interactiveUpdates$1 @ react-dom.development.js:18992
interactiveUpdates @ react-dom.development.js:2169
dispatchInteractiveEvent @ react-dom.development.js:4876

Where can I permanently adjust the parameters TOTAL_MEMORY and ALLOW_MEMORY_GROWTH such that it isn't overwritten the next time I run npm install?