Godot Version
4.2.2
Question
TL;DR
How can I see where is the memory going while running a game? I see that the Memory usage keeps growing indefinitely, but how can I know where is it going? Is it Resources? Objects? Nodes? I don’t see these 3 going up, just the Static Memory Usage…
Full Context
I was developing a small game/app for Android, and suddenly one day I noticed that after using it for a while it closed unexpectedly with no logs whatsoever. I replicated the issue after again using it for a while (there are no certain steps to reproduce it happens after a while after executing lots of actions) and I was with the debugger connected to the Godot Editor to my pc and using adb logcat
to catch any errors but nothing.
I went back to my computer and debugged it to see what might be causing this issue, and I’ve noticed that the Memory/Static usage jumps from the main menu having around 100MB usage to 500MB and continues going up to 700~1000MB as long as i keep advancing.
The thing that puzzles me is that going back to the main menu doesn’t clear the memory usage, it remains on whatever last value was on the scene that was after the main menu, it never goes back to 100MB (it also never goes down, only up)
How can I know where is the memory leak going?
EDIT: Just in case it helps somehow, my app/game is just 2 scenes
- A main menu
- A Scene where everything happens
This second scene ramps up using a lot of RAM the moment I play some WAV files using AudioStreamPlayer. I obtained these WAV files from the internet and processed them with Audacity, then exported them to WAV again with that program. I don’t know if this is related but on rare occassions, I’ve noticed that opening the folder with the WAV files in Windows makes the Windows explorer a bit sluggish.
EDIT2: In case it helps, in the scene where everything happens, there are a lot of tweens. I create them using “create_tween”, each one interpolates around 30 things, when i run these tweens is when the huge memory spikes appear