Number of objects grows rapidly due to input activity (debug monitor)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mazed

I have built a small, very simple demo scene. Apart from a few tilemaps (3, small) and a single Character2D object, nothing is included. In the debugger monitor, however, the number of objects grows rapidly due to input activity (keyboard/gamepad). Within half a minute I have thousands of objects and it keeps growing.

I use normal input routines like:

 public override void _Input(InputEvent @event)
    if (@event.IsActionPressed("GameSelectMenu"))


Vector2 direction = Input.GetVector("MoveLeft", "MoveRight", "MoveUp", "MoveDown");

Does anyone have an explanation for this?

Godot 4.0.3 C# / Win11

:bust_in_silhouette: Reply From: Mazed

If I explicitly dispose the @event object, the growth of the objects stabilises at a high level (1.8k).



using(@event){ ... }

According to the Godot developers, this is a known memory leak. However, it has not yet been classified as a bug because it has little impact on performance, even when there are millions of objects.
Well, you can imagine that millions of objects can also occupy a lot of RAM.