godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Orphan StringNames at exit with minimal project

Open wolsabang opened this issue 3 months ago • 1 comments

Godot version

4.5.stable

godot-cpp version

4.5.stable

System information

Ubuntu 24.04

Issue description

When using gd-extensions "Orphan StringName" are shown is shown at the exit for many RefCounted objects and Nodes. The issue can be reproduced by simply building the "godot-cpp-template" and running godot with "--verbose" .

Steps to reproduce

use Ubuntu Linux 24.04

create project template

mkdir build
git clone https://github.com/godotengine/godot-cpp-template.git
cd godot-cpp-template

replace godot-cpp to work with godot 4.5

rm -Rf godot-cpp
git clone https://github.com/godotengine/godot-cpp.git
git checkout tags/godot-4.5-stable

in CMakeLists.txt add example_class that is already provided in the repository

target_sources(${LIBNAME}
    PRIVATE
    src/register_types.cpp
    src/register_types.h
    src/example_class.h
    src/example_class.cpp
)

build

cd ../../build
cmake ../godot-cpp-template -DCMAKE_BUILD_TYPE=Debug
make

double check that godot-cpp-template/demo/bin/example.gdextension points to "EXTENSION-NAME.linux.template_debug.x86_64.so"

Run

cd godot-cpp-template/demo
/opt/Godot_v4.5-stable_linux.x86_64 --verbose example.tscn

exit the application with "x".

observe console log ... PulseAudio: context terminated Orphan StringName: ExampleClass (static: 0, total: 2) Orphan StringName: RefCounted (static: 1, total: 3) Orphan StringName: Object (static: 1, total: 3) Orphan StringName: ClassDB (static: 1, total: 3) StringName: 4 unclaimed string names at exit.


### Minimal reproduction project

[minproject.zip](https://github.com/user-attachments/files/22375507/minproject.zip)

[outputlog.txt](https://github.com/user-attachments/files/22375509/outputlog.txt)

wolsabang avatar Sep 17 '25 03:09 wolsabang

This is a long-standing issue. I attempted to look into it awhile back, and what I recall finding (which may be incorrect due to my poor memory :-)) was that it was due to an order thing at shutdown. Like, we are counting the orphan StringNames before we fully unload the GDExtensions, or something similar. But I (or someone else) should dig into this again.

dsnopek avatar Sep 17 '25 14:09 dsnopek