[Feature Request] Destroy UMG Widgets

I am working on a mobile game that is entirely UI based and involves recreating the same widget multiple times.

The game was working fine on my computer, but then I was surprised to find that it was slow and lagging on my phone, and, due to the multiple delay nodes, the entire game breaks because the game was relying on that consistent speed.

Going back into the editor, I found the count of my class, that starts off at around 40, ends up at 4,000! The memory leak caused by this is very substantial, especially on mobile. I am using Remove from Parent, but, as we all know, this doesn’t actually destroy the widget.

I can’t imagine why this isn’t already built into the game, but now I’m going to have to create a weird work around of recycling the old widgets, instead of just removing them. This is a huge step backwards and means having to rethink the whole project.

Making strategy game.
2 approaches on healthbar:
A/ add it to all actors on screen from controller, manage all positions, all dynamic progress bar creations and deletions2
B/ all actor adds it onbeginplay, removes it if recentlyrendered check is false

B works awesome. Except widgets are never destroyed. Ever. Nope, GC doesn’t do it either.

So yea, I couldn’t agree more. And indeed, it seems like an absolutely obvious thing. I mean we can destroy actors already, why not destroy UI actors?

Have you tried using UObject::MarkPendingKill() on the UUserWidget to try to force it getting collected by the GC?