Possible memory leak? Issue with changing scenes

Describe the bug
My game has started to freeze when loading in between scenes. I can load up each scene separately and run them just fine but for some reason they won’t load when I advance from scene to scene while inside the game

Ive been dealing with this issue for months now as my game gets bigger and bigger. The only thing that I can find to make it better is to remove objects from the scene or try to reduce file sizes of any models or textures.

It is a 3d game with many .glb models, but even after I compress the heck out of them and make everything ugly, this freeze will still happen after loading enough scenes back to back.

Info i have gathered from testing

. 1. Disabling all extensions does not fix it.
2. Disabling all events does not fix it.
3. Using events to try to unload assets between scene does not fix it (Delete all objects at end of scene, Unload all audio ,etc)
3. Add a short delay between scene transition does not fix it
4. Debugger gives info about Alloctation errors and GLTF errors loading
5. Only thing that fixes it is removing objects/compressing object file sizes, but I have already compressed my files enough and things are looking bad now. Is this an engine limitation? how can I fix it without destroying my visuals?

if I go
Level 1 → Level 2 → Level 3 (freeze on 3)

If I just go Level 3, it works
Any individual level works.

If I go Level 3->4-5 (Freeze on 5)

And so on.

I have found some relevant info in the console

everytime the freeze happens, it gives errors related to the GLTFloader Couldnt load textureblob file://
&
““Array buffer allocation failed””

All audio stops, and the loading bar stops and I have to force quit the game

I asked ChatGPT

My computer has 32gb of ram and never gets anyhere near that, the game is freezing when it takes up 5gb of ram or so (but I am using the preview so the exported game is likely less , hard to see how much the game portion is using)

Is this something i can fix myself, or is it a more fundamental limit I am hitting with something inside of the way models & resources are loaded?

I’d say this is normal…

bcs various things may happen during scene swap that don’t happens when you start a new scene…so say it is a memory leak…wel it could be. …

but then i read “It is a 3d game with many .glb models, but even after I compress the heck out of them and make everything ugly”,

they may not be the culprit but it is not a good sign imho, are you storing something between scene, i mean are these 3D assets deleted during the swap or they stay loaded between scenes?

have you taken into consideration a sort of system which “delete” unused assets “per scene” in a scene before/after the swap?

Thanks for replying!
Yes as mentioned above, I even tried to put ALL objects in each scene into an Object Group, and before calling the scene swap, going “Delete object → Object group EVERYTHING”
(to manually delete all the objects between loads, to try to free memory)
As well as going “Unload all audio” between scenes.
I tried various ways of changing scene, including Pre-loading, and all possible options.

None of it helps the problem.
It is like the engine does not free any memory between scenes, or even deleting objects, and I am hitting some hard limit where it just freezes on loading new scene if I play too many levels.

My game is actually finished besides this issue, so its super disappointing to complete a full game but then i cannot play the whole thing without it freezing!

imo it could be the 3D…from my point of view deleting and reloading a sprite…isn’t the same as deleting and re-loading a 3d model…
I haven’t dig into 3D side…but i guess “something” should stay in memory for the 3D part bcs as i said restoring a 3d object shouldn’t be like restoring a 2d sprite…

…i mean to have a 3D model ready to be loaded…

anyway …it could be a mem leak…but…better wait for an expert answer