godotengine / godotengine/godot-cpp

Orphan StringNames at exit with minimal project

Open
#1,848 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

### 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)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.