Memory never shrinks, once grown. There's no power of 2 requirement - asm.js requires multiples of 16MB, and wasm 64Kb.
On Mon, Mar 18, 2019 at 5:42 PM John Muehlhausen <[email protected]> wrote: > I tried doing a malloc/memset/free of 1800000000ull at the beginning of my > program, which seemed to fix the problem. Once the heap grows this large, > is it ever downsized? If it is downsized then I’m not sure why this > worked, because it seems like there would be no effect from the temporary > usage. > > I don’t think I can set 2gb - 64k because I think the initial memory was > limited to powers of two for a security reason? So 1gb is the largest > initial.... > > On Mon, Mar 18, 2019 at 7:16 PM Alon Zakai <[email protected]> wrote: > >> Yes, when memory grows in asm.js we create a new one, and the old one >> will be GC'd eventually, but when depends on the browser. So both will be >> in memory at once for a while, which can be a problem. >> >> Setting 2GB on Chrome is an issue currently, but I think you can set 2GB >> - 64K, so you can get close. >> >> On Mon, Mar 18, 2019 at 4:56 PM John Muehlhausen <[email protected]> wrote: >> >>> It seems as if my entire heap is being duplicated (due to >>> ALLOW_MEMORY_GROWTH) and then the old one is garbage collected? Is that >>> how it works? Seems like I cannot set an initial size more than 1GB and >>> the "growth" increment is less than 1GB. What I'd really like is to set >>> 2GB (the max?) initially, but it seems as if this doesn't work? >>> >>> On Monday, March 18, 2019 at 4:39:18 PM UTC-5, John Muehlhausen wrote: >>>> >>>> I have a memory-intensive process that runs fine on Firefox >>>> (everywhere) and Chrome (Max+Linux) and Safari. However, Chrome on Windows >>>> "aw, snap"'s me most-- but not all-- of the time. I was finally able to >>>> resolve this with `--max_old_space_size=4096` Chrome command line >>>> parameter, but I don't want to place this requirement on my users. >>>> >>>> My guess is that gc is not keeping up with me on Windows in particular >>>> (fewer points where gc wants to run? ) or else that the defaults differ per >>>> platform. Any ideas about how to nudge garbage collection to happen more >>>> often? Any other thoughts? >>>> >>>> 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 a topic in the >> Google Groups "emscripten-discuss" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/emscripten-discuss/1V1aoe7Pxlg/unsubscribe >> . >> To unsubscribe from this group and all its topics, 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.
