In general, the best you can do is put each game in a JS function scope (the MODULARIZE option can do that for you). Then when that function scope exits, everything inside is freeable by the browser, unless something has a reference to it.
Note that it might still take time for the browser to release the memory, depends on how it garbage collects. On Wed, Jan 25, 2017 at 3:30 PM, Joe Bibbo <[email protected]> wrote: > I have an web-based application that host multiple games. Each game is > built from a C++ library using the emscripten tools, producing a js file > for the game and a js + .data for its filesystem. As the games get very > large, I need a way to unload ( free ) the memory when switching between > games. > > I am loading the game + the filesystem via a $.getscript() calls. Is there > some way, either via a emscripten api or the browser to mark the old game's > memory+filesystem as freed? > > Regards, > Joe > > -- > 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.
