Texture never released from memory when using common activatable widget

We have a setup similar to Lyra example project where we use the PrimaryGameLayout and 4 CommonUI Stacks to push our UI screens and hud as ActivatableWidgets

We noticed however that any texture and sprite referenced by those widgets is never released from memory, even when the screen/widget is popped out of the stack and we confirm that the ref counter to the texture is 0.

We suspect it might be something related to widget pooling but we would like help figuring out what is the bug/issue.

For now the only workaround we found (that however makes the UI development not sustainable) is to

Load/Reference all textures from soft references when the widget is activated and manually set the brush back to empty when the widget is deactivated.

Do you have any insight on why CommonUI Activatable widgets together with Stacks could cause such an issue? Is there a way to force the pool to be cleared when changing experience for example? [Image Removed]

Steps to Reproduce
We have a setup similar to Lyra example project where we use the PrimaryGameLayout and 4 CommonUI Stacks to push our UI screens and hud as ActivatableWidgets

Add and remove Screens/Widgets to one of the stacks multiple times and load into different levels/maps.

Observer that the allocated memory for textures keeps growing and textures referened from closed screens (deactivated and removed from the stack) are never released

Hi,

The ActivatableWidgetStacks used in the PrimaryGameLayout setup do pool widgets by default, so it sounds like that could be the culprit here. How are you removing the widgets from those stacks? If you’re using Pop Content from Layer then the widget should be removed from the pool, a breakpoint in UCommonActivatableWidgetContainerBase::ReleaseWidget could confirm this. We’d expect to see that call to GeneratedWidgetsPool.Release, so you could inspect the pool there and see if anything unexpected is in there.

Another good thing to try here would be “obj list name={texturename}” in the console, which should give you the reference chain. That should point to whatever object is keeping that texture from being garbage collected.

Best,

Cody