32 bit Machine - Memory Allocation

Hi,

I’m having trouble with my WebGL build to play on Chrome and Firefox in a 32 bit Machine.

I’ve set my TOTAL_MEMORY to 359715200
This work perfectly on the 64 bit machine.

In the 32 bit machine with Chrome it works the first time. When I reload the page to run it again I will have a Out of Memory Popup that ask the Developer to increase the Total Memory, or a “Array Buffer allocation failed” message.

In the 32 bit machine with FireFox it works the first time. When I reload the page I have a “Out of Memory” message in the console, or have a Out of Memory Popup that ask the Developer to increase the Total Memory.

They are not consistence to if it will run or not, and which message to display.

However, When I Close the browser and reopen it again it seems like it works every time.

Any ideas as to how I can get 32 bit Chrome and FireFox to start the project correctly when the user reload the page?

Thank you

The problem here is that browser memory gets fragmented when the browser has been running for a while and navigating to different pages, so it will no longer be able to find a consecutive block of free space of the requested size in it’s heap. When you start the browser fresh, it has a clean heap, and it can find a free block of the size. Technologies which will make this problem go away are 64-bit browsers and, maybe in the future, out-of-process execution of WebAssembly. But that does not help you supporting 32-bit machines today.

In Chrome, what may help today, is to make your content spawn a new tab on load, and run in that. In Chrome, each tab runs in a separate process, so by creating a new tab, you get a fresh heap.

Other then that, the only thing you can do is to optimize your content to require less memory.

1 Like