pkdawson / imgui-godot

Dear ImGui plugin for Godot 4
MIT License
423 stars 24 forks source link

Memory leak! #36

Closed k-preslav closed 1 year ago

k-preslav commented 1 year ago

The plugin is great, but there is a small memory leak. I noticed that my static memory graph was going up. I had some footage of the game before I installed the plugin and the graph didn't go up. Then I disabled the plugin and the memory leak is gone.

Here is a short video: https://github.com/pkdawson/imgui-godot/assets/96019707/8ccfc1a1-3677-4192-b363-4f13719fe902

pkdawson commented 1 year ago

Thanks for the report. I'm not able to look into it right now, but I'll do a thorough leak analysis with Visual Studio before the end of the month.

I'm not sure, but it's possible that those are just normal allocations on the .NET managed heap which get garbage collected eventually. But I try to minimize those anyway, so this is worth investigating.

pkdawson commented 1 year ago

Fixed in v4.0.3

Confirmed that this is just the garbage collector being lazy about cleaning up certain objects. But we can avoid some allocations and do a little manual cleanup of other stuff, so there's no more constant increase of memory usage.