Godot Version
Sdk="Godot.NET.Sdk/4.4.1"
Question
I have a followup question regarding this thread: Does the GC collect GodotObject Instances?
The documentation page for RefCounted states:
// Note: In C#, reference-counted objects will not be freed instantly after they
// are no longer in use. Instead, garbage collection will run periodically and will
// free reference-counted objects that are no longer in use. This means that unused
// ones will remain in memory for a while before being removed.
The dotnet runtime already maintains a reference count for all your objects so it can run its garbage collector. If that’s all RefCounted does, then doesn’t that make it redundant in C#?
GodotObject is IDisposable so any memory cleanup that the engine requires would be implemented in Dispose() or the base finalizer when the GC does its thing. Or am I wrong?
Is there any advantage to using RefCounted over GodotObject? It seems like that makes it do the same thing twice.