iOS browser memory leak

Has anyone noticed that even on Latest version iOS/ babylon is crashing due memory leak, if you start any babylon app and it runs, then reaload a couple of times, or change the web to another babylon app, the browser memory gets filled and you get to a point that you can no longer use babylon at all on your iOS device ( on low memory iOS like ipad, iphone, ipad pro looks like does not has this issue), it just crashes, you will need to clear cache and perhaps even restart the device to get it to work again, this is present on all babylon, just tested with a bunch of demos from the main page and the issue is even there.

This is a nice place to test the above:
Babylon.js — JS Game Rendering Benchmark (shirajuki.js.org)

Once it breaks it will not load anything from babylon until you clear cache- restart device

Welcome aboard!

I tested the page (count=10000) on my iPhone SE, iOS 16.6.1, and even after reloading the page 50 times, it didn’t crash.

[…] I’ve just installed the latest version of iOS (17.2.1), and there was no crash either after 50 reloads of the page.

Let’s see if other people have the same problem as you.

@Yoshi_Morales,
Could you specify what browser do you use?
I don’t have this issue with iOS v17.1.2 iPhone 13 mini on chrome

I have tested on ipad pro M2 it gets to 10000 no sweat any amount of reloads

On iphone 14 pro max 10000 breaks it and you are not able to re use Babylon as a test

Similar on ipad 5th gen

All iOS devices even of the name says something different is using safari in the background

Hi!

My 2 cents about iOS/MacOS browser memory management (not just Safari, but Chrome and FF as well):

I ran into memory management problems on our project on these operating systems. Windows/Android was not affected. I Googled some documents from Apple explaining how memory allocation is enforced in browsers running on Apple products.

The OS is trying to avoid the app to allocate too much memory so the browser or the whole OS will not become unresponsive so there are some mechanisms preventing this to happen. If your app reloads or just renders a black screen it probably means you triggered the memory protection. Unfortunately there are no exact papers on which version of the OS is affected in which way but in general:

  1. You can not allocate too much memory at once. In my case I couldn’t load a big GLB into memory (I was using Chrome on iOS and as I said Windows and Android worked well) but when I splitted the GLB into smaller GLBs I could load them into the scene.
  2. This one is weird - the docs said in some cases you can trigger memory protection when you’re allocating memory too fast… LOL
  3. The amount of memory available to the browser can be different on different minor versions of the OS

Our product was intended to run on all Apple tablets but we are supporting only iPad Pro for now which doesn’t seem to have issues running the same code as the desktop version or any other shitty Android tablet or even on a Honor 20 Pro phone (released in 2019) runs well.

I’d like to add that this was the case a year and half ago and we gave up trying to get the app running on all iPads and our customers are OK to use Android tablets instead or upgrade to iPad Pro.

Good luck!

:vulcan_salute:

2 Likes