Godot 4.4.1 HTML Exports resets/crashes when playing on mobile browsers

Godot Version

4.4.1.stable

Question

Hello everybody, I’m currently facing a big problem with html–exports , which I’ve noticed to be very common with people using any 4.x version. As far as I know, there were also no difference if you host your game yourself or through itch.io, the game seems to crash all the time after a certain time or after a certain amount of actions on any mobile device (+ any browser → I tested on Safari (for iOS), Firefox(Android & iOS) and Chrome(Android & iOS).

More about my project to give some context: It is a simple card swiping game, where you swipe through differently told stories about different topics. The goal is to swipe the cards correctly to get all the points in the end. With every active card, there is also a corresponding picture which is displayed and also tells the story (The picture is being displayed by assigning a png on a TextureRect). On every successful swipe, the texture of the picture and the text of the button are being dynamically changed. During this process, I implemented also a little workaround to set the textures to null and to “free” them in order to free some memory during this period (I also built in a small 0.2 timer, to make sure that the script really goes through all of it.

I worked with methods like:

  • queue_free() → and later on actually freeing them because queue_free() isn’t enough
    • specifically for nodes that are not used anymore (e.g already swiped cards during the story)
  • setting textures to “null” → Because Godot 4.x frees those at the end of a frame.
  • working with “change_scene_to_packed()” because this apparently frees things too when used for switching scenes

But for some reason, even though I have built in this cleaning process, my devices still get really hot in the back after some time which to me signifies, that the CPU (and also because of the high memory usage) is still working really hard for something which is either still loaded or still loaded and visible somewhere. In that regard it also surprises me, that the functions for changing scenes and for freeing nodes aren’t really working to my liking (or the Garbage Collector of Godot isn’t that reliable as it seems? I really have no clue anymore)

I’ve been dealing with this problem for over 1 week straight, trying to find a good fix. If there is no bullet-proof answer or solution, then it leaves me with one question: Is it worth downgrading to Godot ver. 3.6? Is it really that much stable as people say here in the forum?

Other than that, I would be happy to get some feedback or possible solutions. If you need more clearance about my project and want to help out, let me know and I’ll send and show you some screenshots or code snippets of my project.

Wait for Godot 4.5 beta 2 and see if it’s better

There was a fix recently about memory leaks with Webkit (web engine used in all iOS browsers). However you said you were having the issues on Android too, so you might still have your issue…

Thanks for your response and for the information!

Could you tell or show me which Godot Version/Release has the recent memory leaks fix? Is it already in Godot 4.5 beta 1? I would love to know to set it up and test it, to see if it potentially fixes the issue that I’m having with iOS (also with Android too).

I don’t think it’s there in beta 1, you’d have to wait for 4.5 beta 2.

Otherwise, you could build Godot’s master branch yourself (or find somewhere a provided build, I don’t know if they provide regular ones)