Kehom / GodotAddonPack

A collection of pure GDScript addons for Godot
http://kehomsforge.com
MIT License
183 stars 15 forks source link

Resource Leak Investigation #34

Closed Kehom closed 2 years ago

Kehom commented 3 years ago

Hello everyone.

I'm opening this issue to let you know that I'm aware of a problem with resource leaks, more specifically with the Inventory, Network and DebugHelper plugins.

Specifically for the Network and the DebugHelpers the error message will appear only if at least one of those plugins is enabled. I have tested forcefully freeing the two automatically created singletons at the plugin's _exit_tree() function and the error message went away. I will further investigate to identify if this is a problem with the code or a bug in the EditorPlugin.add_autoload_singleton() function.

As for the Inventory, the problem is a bit more complicated. On my preliminary tests it seems the root cause of the problem is in any script class that static types "itself", something like this:

extends whatever_that_is_a_reference
class_name some_class

func some_func(some_arg: some_class)....

Just having a script with code like this will result in resource leak error message.

Based on this information, I'm not sure about the severity of the problem on the Inventory plugin, however it's probably harmless on the Network and the DebugHelpers plugins, as the problem seems to be that the singletons are not freed in time during the exit process.