# iOS - cannot open an app on iOS browsers. Memory limit

**URL:** https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698
**Category:** Questions
**Created:** [May 11, 2023, 12:12pm UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698 "2023-05-11T12:12:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)
#### Post date: [May 11, 2023, 12:12pm UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/1 "2023-05-11T12:12:58Z")

</div>

Hi. I have an app

[https://sauna.symbo-w3.io/](https://sauna.symbo-w3.io/)

This app recently was working properly on all browsers. Recently this changed and my apps started crashing on iOS, to be honest I am not an iPhone user so I am not quite sure what changed recently regarding the iOS system.

After inspection, this is the message I get when I try to open the app

“Total canvas memory use exceeds the maximum limit (256mb)”  
“WebGL: Invalid Value: texImage2d: no canvas”

Couple of my apps stopped working on the IOS recently. And they worked properly before. Now, I somewhat understand what is going on, and I will try to optimize my assets further to see if it will help, but I am just not sure why it worked before and now it doesn’t with literally nothing being changed regarding the project files.

Any suggestions?  
Thanks

---

<div class="post-metadata">

### Author: ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)
#### Post date: [May 11, 2023, 12:37pm UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/2 "2023-05-11T12:37:11Z")

</div>

I didn’t see any amount of texture that would exceed 256mb total. Do you create a lot of render targets? how many vertices/faces in your geometry?

---

<div class="post-metadata">

### Author: ![DRLeria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drleria/32/50928_2.png) [@DRLeria](https://forum.babylonjs.com/u/DRLeria)
#### Post date: [May 11, 2023, 12:48pm UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/3 "2023-05-11T12:48:27Z")

</div>

I was able to get it to work on an iphone 12 by disabling WebGL via Metal in Safari’s experimental features. I’ve had some problems with iOS devices, but it’s still not a viable solution.

I also think you should review the optimization of the project assets  
You can use GLTFReport to optimize textures or compress the GLB model (Draco or MeshOpt), it’s very easy to use.

> **[glTF Report](https://gltf.report/)**
>
> Viewer, analysis tool, script editor, and validator for 3D models in glTF 2.0 format.

Try to reduce the size of the textures to 512px, especially the lightmaps  
It also reduces the images of the icons, to 128px I think it would be correct.

Another important issue is, are you loading all the models when you start the app?  
The ideal would be to load the main model and load the other models as you use them and download memory.

Try using AssetContainer, it’s very comfortable and allows you to quickly add or remove models

Finally, have you tried updating to a more recent version of Babylon? I have seen that you are using 4.2

---

<div class="post-metadata">

### Author: ![Mostafa\_Salloum](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mostafa_salloum/32/13074_2.png) [@Mostafa\_Salloum](https://forum.babylonjs.com/u/Mostafa_Salloum)
#### Post date: [May 11, 2023, 1:04pm UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/4 "2023-05-11T13:04:38Z")

</div>

if you’re having a problem on ios with the textures I think ios devices can’t render textures above 4k.

---

<div class="post-metadata">

### Author: ![brightMoon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brightmoon/32/9959_2.png) [@brightMoon](https://forum.babylonjs.com/u/brightMoon)
#### Post date: [December 4, 2024, 1:47am UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/5 "2024-12-04T01:47:23Z")

</div>

I also encountered this problem, the 4k texture browser keeps refreshing

---

<div class="post-metadata">

### Author: ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)
#### Post date: [December 4, 2024, 5:38pm UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/6 "2024-12-04T17:38:43Z")

</div>

Hi guys. This issue is mentioned in many other threads since I posted this question. Even though I am the one often answering those questions I never actually closed this thread, as I completely forgot about it.

Here are some of threads where the issue is mentioned if you find it useful

> [@Ipad pro 2 loading bug](https://forum.babylonjs.com/t/ipad-pro-2-loading-bug/32081/6):
>
> First thing that pops to mind whenever dealing with iOS is memory limit. Try reducing texture size to 1k and less, and see if it changes anything.

> [@Babylon JS keeps refreshing on iOS](https://forum.babylonjs.com/t/babylon-js-keeps-refreshing-on-ios/19966/11):
>
> NOTE: I cannot confirm, but using env on iOS (where you could have trouble with webgl2 features, because… APPLE I guess) MIGHT NOT WORK as it seems to use weblg2 features indeed. As I said, I cannot confirm,cause I have no idea what is actually going on in the env implementation (I will probably look into that more though)

> [@GLTF model crashes ios browsers](https://forum.babylonjs.com/t/gltf-model-crashes-ios-browsers/46085/2):
>
> Hi. The issue is that ALL of your textures are 2k resolution. IOS has it’s own thing and some limitations, and the issue you are describing usually comes from the large textures. It’s really not easy to define how many textures you can have, and how large they should be to avoid this issue. I usually keep it to this rule though → “Limit your textures for IOS to MAX 1k resolution”. If you have a lot of textures, even this might be reduced in some places. Basically, it’s not that you cannot have…

> [@This basic model import playground causes an iPhone device to crash. Please assist](https://forum.babylonjs.com/t/this-basic-model-import-playground-causes-an-iphone-device-to-crash-please-assist/45121/9):
>
> Hi. It’s really hard to say and predict the number and size of textures that will work on IPhone. Could you try to reduce all textures to max 1k res? Try to do it with like 512 to 1k texture size and check if it works. From my experience limiting resolution to MAX 1k works on IPhone. I didn’t have a situation though, where I had 200+ textures in the scene, so I am not sure if this limit to 1k will work. But for the test purpose I think it would be informative for all of us to see if that works…

> [@This basic model import playground causes an iPhone device to crash. Please assist](https://forum.babylonjs.com/t/this-basic-model-import-playground-causes-an-iphone-device-to-crash-please-assist/45121/9):
>
> Hi. It’s really hard to say and predict the number and size of textures that will work on IPhone. Could you try to reduce all textures to max 1k res? Try to do it with like 512 to 1k texture size and check if it works. From my experience limiting resolution to MAX 1k works on IPhone. I didn’t have a situation though, where I had 200+ textures in the scene, so I am not sure if this limit to 1k will work. But for the test purpose I think it would be informative for all of us to see if that works…

To sum up. Usually the issue comes from the textures and their resolution. It’s hard to say what are actual limitations, but keeping textures around 1k resolution usually works. The rest is pretty much relying on testing.

If you have small number of textures you can go higher resolution on those. If you have huge amount of textures, it’s important to keep them optimized as much as possible.

---

<div class="post-metadata">

### Author: ![brightMoon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brightmoon/32/9959_2.png) [@brightMoon](https://forum.babylonjs.com/u/brightMoon)
#### Post date: [December 5, 2024, 6:52am UTC](https://forum.babylonjs.com/t/ios-cannot-open-an-app-on-ios-browsers-memory-limit/40698/7 "2024-12-05T06:52:56Z")

</div>

You’re amazing
