Open Buster28 opened 3 years ago
That is caused by not being able to grow memory when you need to. Your application is trying to malloc more than the memory allows. Enabling memory growth, or increasing the initial memory size, may help.
But this is old version right? So enabling memory growth is not supported explicitly with pthread. But, yes internally I think it is switched on that's how our emscripten code is running.
Fyi, i have allocated total memory which is initial memory is 32 mb. What value do you recommend?
That is a pretty old version, yeah, it might be that growth was not supported there. You can try a larger initial size of memory then. What the right value is depends on your codebase and where it is run.
@kripken the app we are using we have provided 32 mb memory, and we have seen the memory growing further also , when we run the application. Also, we are not getting crash on initialization. It comes in long running programs.
So, just wanted to confirm, what does that total memory mean here? and how it is consumed or used? how it;s impact will be changed when we will increase total memory from 32 mb? By increasing memory, will it really affect the long running programs?
The wasm memory uses something much like a typed array - a flat contiguous region of memory. That is allocated to the "initial" size at the start. The browser uses up all that memory. Emscripten then allocates within that region using malloc. You can use mallinfo()
to get statistics about how much is used, etc. As more memory is used, or as memory gets fragmented, emscripten will use more and more of the wasm memory. If it runs out, it will need to grow the memory.
Exactly in our case, the memory is growing since at the start our application is not crashing. So, would it affect anything if we will increase the initial memory ?
@kripken Need guidence to debug the issue