Problems with Garbage Collection in UMG Widget.

I’m facing this error for a while now. I did not find anything helpful in the internet yet.

Anyone has a solution for that?

I have a native Widget Baseclass that is overriden with a blueprint class. I’m spawning it and it works all fine. When I stop playing in PIE I get this GC error tho.

I didn’t forgot to call super or anything like that. I already tried Releasing The Slate Ressources, Resetting the Pointer, etc. Is that a Engine Bug?

LogOutputDevice: Error: Ensure condition failed: !IsGarbageCollecting() [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\UMG\Private\Slate\SObjectWidget.cpp] [Line: 41]
LogOutputDevice: Error: SObjectWidget for 'WBP_ChatMessage_C /Engine/Transient.UnrealEdEngine_0:BP_Horde_Instance_C_1.WBP_ChatMessage_C_0' destroyed while collecting garbage.  This can lead to multiple GCs being required to cleanup the object.  Possible causes might be,
LogOutputDevice: Error: 1) ReleaseSlateResources not being implemented for the owner of this pointer.
LogOutputDevice: Error: 2) You may just be holding onto some slate pointers on an actor that don't get reset until the actor is Garbage Collected.  You should avoid doing this, and instead reset those references when the actor is Destroyed.

Also created a reddit thread:

Steps to repo:

  • Create a C++ Class inhired from UserWidget.
  • Create a Blueprint from the C++ Class.
  • Call CreateWidget in you C++ HUD Class with the Compiled Blueprint Widget Reference
  • Have a Scrollbox inside the Blueprint Widget.
  • Create an Widget inside the blueprint Widget and add it to the Scrollbox
  • Crash should appear in PIE when pressing Play and Escape to end PIE (Happens not all the Time. Seems like when you open the Widget Blueprint Editor the crash is gone. After restarting the Editor it’s there again.)

Have a nice week!

1 Like

Amazing, thank you for the repro steps. I’m working with a bit older version of UE4 right now, and it’s gonna be super helpful to know that probably the scrollbox is messing things up. I had no idea when the error started to show up, that would be such a pain later on. Thank you!

Hi FinalSparkGames.
I have same problems.
I find a class ‘FReferenceChainSearch’. It will tell you who reference to the object. You will get more detail.

Still got it in 5.2

See my comment.

1 Like