Our malloc is dlmalloc (see system/lib/dlmalloc.c). Yes, in some use patterns, it can fragment significantly.
It might be beneficial for you to use a custom allocator given your use patterns (perhaps written in C on top of malloc/free). On Fri, Aug 12, 2016 at 3:10 AM, Gaurav Dewan <[email protected]> wrote: > What is the recommended method of allocating and reallocation large memory > size buffers in ASM.JS build ? > > We are allocating large memory (40MB and more) and on reallocation (as > seen in memoryprofiler) the buffers keep jumping to higher location leading > to fragmentation. > > Sometimes fragmentation is clearly visible in memoryprofiler graph(but not > always) where tiny objects are allocated just near to huge objects so when > huge object is reallocated, it must move to higher memory leading to large > amount of lower memory remaining unutilized and running out of memory even > when there is 30% actual memory use(dynamic memory as % of all free space). > > Another characteristic is that running the same sequence of commands > faster (as compared to issuing the commands slowly) causes greater degree > of fragmentation. > > Is the memory allocator (malloc/free) derived from gcc/some C runtime ? > > Can we reserve a portion of memory for chunky allocations and tiny > allocations separately? > > -- > 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.
