You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object instances can hold GDNative instance binding data (for example, that data can correspond to class wrappers inside of NativeScript libraries). This data is normally freed in the destructor of Object... unless ScriptServer::finish_languages(); is called before. In such case the data will leak.
This leads to instance binding data being attached (only the first time) to the object.
Unfortunately, it never gets freed, because on quit, things happen in this order:
ScriptServer::finish_languages();
Our GDNative library gets terminated
Godot deletes the GDNativeLibrary
By extension, it also means if a library wants to hold a Godot object as internal singleton (like it happens sometimes in modules), the instance binding data of such objects will always leak, even if the object is freed in the terminate callback.
Eventually there should be an error printed when stuff like that happens, because currently it's completely silent and I had to investigate for a while.
In the C++ bindings we might be able to workaround this by avoiding the use of instance binding data (so, using the C API directly without any helper). Wether this should be allowed or not I don't know, but it looks like a bug from Godot.
The text was updated successfully, but these errors were encountered:
Godot 3.2.2 beta3
Windows 10 64 bits
Object
instances can hold GDNative instance binding data (for example, that data can correspond to class wrappers inside of NativeScript libraries). This data is normally freed in the destructor ofObject
... unlessScriptServer::finish_languages();
is called before. In such case the data will leak.Turns out that's the case I found.
In C++ bindings, we access our own
GDNativeLibrary
here: https://github.com/GodotNativeTools/godot-cpp/blob/e97e86648355cbe61c6249483c6f2a5d1b41714f/include/core/Godot.hpp#L43This leads to instance binding data being attached (only the first time) to the object.
Unfortunately, it never gets freed, because on quit, things happen in this order:
ScriptServer::finish_languages();
GDNativeLibrary
By extension, it also means if a library wants to hold a Godot object as internal singleton (like it happens sometimes in modules), the instance binding data of such objects will always leak, even if the object is freed in the terminate callback.
Eventually there should be an error printed when stuff like that happens, because currently it's completely silent and I had to investigate for a while.
In the C++ bindings we might be able to workaround this by avoiding the use of instance binding data (so, using the C API directly without any helper). Wether this should be allowed or not I don't know, but it looks like a bug from Godot.
The text was updated successfully, but these errors were encountered: