bitwes / Gut

Godot Unit Test. Unit testing tool for Godot Game Engine.
1.86k stars 101 forks source link

Memory leaks when exiting Godot. #483

Open drwhut opened 1 year ago

drwhut commented 1 year ago

This was originally posted in #122, but I've made a new issue at the request of the author.

I've started using Gut 7.4.1 in my project, and I've noticed that it has a lot of memory leaks when exiting Godot.

For context, I've downloaded the add-on via the in-engine AssetLib on the official 3.5.2 build (Godot_v3.5.2-stable_x11.64) to a newly created project with no tests or configuration files made, and this is the output when running the engine with --verbose:

gut.log

Additionally: Even though this only occurs when exiting Godot, and even though Godot should keep track of and properly free all orphan resources and string names, it is still incredibly annoying to see every time I exit Godot via the command line. Plus, it makes debugging memory leaks from my own code much harder, since they are essentially hidden within Gut's own leaks when using --verbose.

bitwes commented 1 year ago

I'm not sure when I'll be able to get to this, but I might be able to help you work around it. Are you creating an editor plugin or a game? If you are creating a game, then I'm not sure you would see any orphaned nodes from your game when you exit the editor.

drwhut commented 1 year ago

A game. While that is the case when running the game via the editor, sometimes I need to run the game standalone in order to test the multiplayer.

bitwes commented 1 year ago

I created a simple project that just has a single scene in it and the GUT plugin installed. running Godot using --verbose from the command line, in the directory launches the game but when I exit the game I'm not seeing the orphaned items as I do when I launch the editor from the command line with --verbose.

I'm on a Mac, using iTerminal and zsh. Here's the commands I've been testing with:

export GODOT="/Applications/Godot/Contents/MacOS/Godot"
alias godot='eval $GODOT'

Can you provide details on how you are launching Godot? Are you referencing GUT inside your game somewhere?

drwhut commented 1 year ago

Apologies, I thought the memory errors also appeared in exported projects, they do not. It is only when closing the editor.

I am using the same command as you to launch the editor: ./godot.x11.opt.tools.64 -e --path <PATH_TO_PROJECT>

bitwes commented 1 year ago

Ok, cool. So they aren't getting in the way of you tracking down other leaks then?

drwhut commented 1 year ago

Not as of now, no.

bitwes commented 1 year ago

Great. I agree this should still be cleaned up. Feels dirty having things leftover at the end, but if they aren't getting in the way of progress then I don't have to rush to fix this. Thanks for you help with this one.

m21-cerutti commented 8 months ago

I confirm there is also memory leaking on 9.1.1 too. Not urgent at the moment for my needs.