rich-iannone / DiagrammeR

Graph and network visualization using tabular data in R
https://rich-iannone.github.io/DiagrammeR/
Other
1.7k stars 248 forks source link

Cannot enlarge memory arrays when trying export_graph with larger graph #310

Open fmannhardt opened 6 years ago

fmannhardt commented 6 years ago

I am trying to save a larger graph created with DiagrammeR using _exportgraph (tried formats SVG, PNG, PDF) and come across this error:

Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 268435456, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 
Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 268435456, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 
Warning: Error in context_eval: abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 268435456, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ") at Error
    at Error (<anonymous>)
    at Ga (<anonymous>:49:124)
    at Fa (<anonymous>:49:22)
    at v (<anonymous>:1183:101)
    at Function.n.ba [as Wa] (<anonymous>:34:488)
    at uc (<anonymous>:1103:161)
    at eQ (<anonymous>:1168:7157)
    at zz (<anonymous>:1160:92650)
    at yz (<anonymous>:1160:92582)
    at xg (<anonymous>:1166:7191)
    at Bi (<anonymous>:1166:107264)
    at zi (<anonymous>:1166:106143)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
  [No stack trace available]

It seems that some memory limit is hit when rendering the graph using viz.js. The author of viz.js is recommending that an option totalMemory might be used to prevent that here mdaines/viz.js#89 Could you make this configureable in DiagrammeR?

trikiamine23 commented 4 years ago

Any news regarding this error ?

pitercius commented 4 years ago

If somebody needs to solve this, I changed the viz.js script (e.g. C:\Program Files\R\R-3.6.2patched\library\DiagrammeR\htmlwidgets\lib\viz\viz.js) and in each TOTAL_MEMORY and totalmemory var I have written my own number (e.g. 503316480) and... it works!