godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.62k stars 20.77k forks source link

Possible memory leak when importing a large git cloned repository. #97610

Open cryoboltinteractive opened 2 days ago

cryoboltinteractive commented 2 days ago

Tested versions

Reproducible in - v4.3.stable.mono.official [77dcf97d8]

System information

Godot v4.3.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2050 (NVIDIA; 32.0.15.5612) - 11th Gen Intel(R) Core(TM) i5-11260H @ 2.60GHz (12 Threads)

Issue description

A Large Godot Project hosted on a Git server (4 GB of Assets, >50,000 Files) when cloned and imported without the (.godot) folder, in a machine with 16 GB of RAM will use all system memory and will 100% of the time result in a full system crash, not just the godot Engine. This happens at around 96% to 97% of the import. Tested on the following Machines Macbook Pro 15 inch 2017 (Core i7 - 7820HQ, 16GB DDR4 RAM, Radeon Pro 560) (System Crashed) (5 Attempts) Asus Zepherus G14 (AMD Ryzen 7 6800HS, 16GB DDR5, RTX 3060 ) (BSOD) (4 Attempts) Asus TUF F15 (Intel Core i7 11260H, 16 GB DDR4, RTX 2050) (System Crashed) (2 Attempts)

Asus TUF F15 (After Upgrade) (Intel Core i7 11260H, 32 GB DDR4, RTX 2050) (Import Success) (First Attempt) Desktop 1 (AMD Ryzen 5 5600, 32 GB DDR4, RTX 3070) (Import Success) (First Attempt) Desktop 2 (AMD Ryzen 5 3600, 32GB DDR4, RTX 2070) (Import Success) (First Attempt)

However even on 32GB of RAM it uses all resources and even after importing, it will continue to use in excess of 22GB RAM image but if you restart Godot after importing everything, it will not use more than 2GB of RAM image

Steps to reproduce

We cannot unfortunately share steps as it is just importing an existing project

Minimal reproduction project (MRP)

We cannot provide an MRP as the licenses on certain assets do not allow us, how ever we are always available on discord call to talk and maybe help rectify the issue.

Nazarwadim commented 1 day ago

I can confirm the problem at https://github.com/godotengine/tps-demo. Appears in ResourceCache. Once exported, it has over 300 resources and uses 1.5 GB of RAM. After restarting the project there are only 6 resources and 0.6 GB memory usage.

cryoboltinteractive commented 1 day ago

@Nazarwadim Can you confirm if it was on import? Our issue was raised on importing a project, you have mentioned on export, so we're just trying to clarify. On our internal test with the TPS demo, on import it uses 1.4 GB of RAM and on restart it uses ~750MB. Probably not a huge deal, but on large projects this issue is multiplied.

Nazarwadim commented 22 hours ago

Yes on import. Made a typo