Another way should be to use the file packager --no-heap-copy option. With that option, the loaded .data file is not attempted to be stored in the Emscripten HEAP, but it is retained as a separate typed array in JS land. That can avoid blowing up the heap immediately on load.
2015-06-12 3:38 GMT+03:00 ZengRui Wang <[email protected]>: > Oh, yes. I found that if I use TOTAL_MEMORY=X, everything is OK. Thank you! > > On Thursday, June 11, 2015 at 5:25:59 PM UTC-7, Alon Zakai wrote: >> >> Looks like with a large enough data file, and with memory growth enabled, >> we end up growing memory before startup is complete, which triggers an >> overly-careful assert. Fixed on incoming, it is ok to allow the memory swap >> method. >> >> On Thu, Jun 11, 2015 at 5:08 PM, ZengRui Wang <[email protected]> wrote: >> >>> Also, it works fine when I just load a txt like hello_world_file.txt, >>> but the large size file will fail. >>> >>> >>> On Thursday, June 11, 2015 at 5:03:02 PM UTC-7, ZengRui Wang wrote: >>>> >>>> Hi, >>>> >>>> I am trying to preload a directory of data file which is about 24 MB. >>>> But I ran into an Assertion failed: you need to wait for the runtime to be >>>> ready (e.g. wait for main() to be called); >>>> This is the C++ code, when loaded, it alerts the message. >>>> >>>> #include <stdio.h> >>>> #include <emscripten.h> >>>> >>>> int main() { >>>> EM_ASM(alert("done!")); >>>> return 0; >>>> } >>>> >>>> The Error output in Javascript console is: >>>> >>>> Uncaught abort("Assertion failed: you need to wait for the runtime to >>>> be ready (e.g. wait for main() to be called)") at Error >>>> at jsStackTrace ( >>>> http://localhost/smartbody/BoostFilesystem.js:2198:13) >>>> at stackTrace ( >>>> http://localhost/smartbody/BoostFilesystem.js:2215:22) >>>> at abort (http://localhost/smartbody/BoostFilesystem.js:70341:44) >>>> at assert (http://localhost/smartbody/BoostFilesystem.js:1410:32) >>>> at asm._emscripten_replace_memory ( >>>> http://localhost/smartbody/BoostFilesystem.js:68453:8) >>>> at enlargeMemory ( >>>> http://localhost/smartbody/BoostFilesystem.js:2279:44) >>>> at Function.Runtime.dynamicAlloc ( >>>> http://localhost/smartbody/BoostFilesystem.js:1373:202) >>>> at _sbrk (http://localhost/smartbody/BoostFilesystem.js:8121:28) >>>> at Object._malloc ( >>>> http://localhost/smartbody/BoostFilesystem.js:57241:16) >>>> at processPackageData ( >>>> http://localhost/smartbody/BoostFilesystem.js:580:34) >>>> >>>> I am still confused how to tell the loading process is done. >>>> >>>> Thanks! >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
