Open pi4erd opened 1 year ago
Sorry for a long period of inactivity. Just tested on Godot v4.3.rc1 - macOS 15.0.0 - Vulkan (Forward+) - integrated Apple M2 - Apple M2 (8 Threads)
, the issue seems to persist with the reproduction project in the same way as on Windows. I am going to test it on Linux when I can.
I made the code runnable without errors, and in the end the memory doesn't persist after successful runs.
Just tested Mobile and Compatibility renderers. Mobile has the same issue but Compatibility clears up everything properly on the same setup. Could it be an issue in Vulkan backend somehow?
I made the code runnable without errors, and in the end the memory doesn't persist after successful runs.
Can you update the MRP in the original post accordingly? Thanks in advance :slightly_smiling_face:
Can you update the MRP in the original post accordingly
I'm sorry, but do I understand correctly that I should upload successfully run code as well? If that's the case, I will do it shortly.
I uploaded a successful MRP, you can check. Just in case I tested beforehand, there doesn't seem to be any signs of memory leak when the project is run successfully.
After a few tests I've discovered that this memory leak has nothing to do with rendering. Memory leak happens if we allocate a packed array not exceeding the size of 1048568 bytes and any error happens before the end of the scope (presumably before the array is destroyed). If the array size is any bigger than this number, then there is no apparent leak even if an error occurs. I am going to debug the engine later to check if I can find anything of note.
I am still confused that Compatibility didn't leak memory for me before. I can't reproduce it anymore, my script leaks memory even in Compatibility mode.
Godot version
Reproducible in: v4.0.3.stable.official [5222a99f5], v4.3.rc1, v4.3.rc2.official [3978628c6]
System information
Windows 11 - Godot v4.0.3.stable.official - Vulkan (Forward+)
Issue description
If an error is thrown in the same scope after we have allocated a packed array of specific size (up until 1048568 bytes) Godot leaks memory even after the game is closed. The leaked memory stays until Godot is restarted.
Also memory leaked seems unreasonably big for an array 1MiB in size.
Normal usage:
After a few runs (with errors):
Same thing on Arch Linux (KDE, v4.3.stable.mono.arch_linux):
After 1 single run:
The game is not running in either of those pictures. The memory usage stays on the same level until Godot is restarted.
If the code doesn't throw any errors, the memory is cleaned up properly.
Steps to reproduce
Minimal reproduction project
real_minimal_repro.zip