How to fix "xxx Not cleaned up by garbage collection"

Hi,

I am new to game development and Unreal Engine 4. I am using version 4.6.1

I am trying to change the materials using UMG buttons in 3 levels (using UMG buttons) but I am getting the following error and the editor closes when I go to another level.

I even tried to remove the viewport i.e. remove the parent (user widget) before opening the another level. But still I couldnt fix this problem. I even attached my level blueprint here.

Can somebody please help me to fix this issue?

Thanks in advance!

Try removing your widget from parent before you open another level.

Thats what I did in Level blueprint which is attached above. Please check the blueprint and let me know.

I even tried “remove from parent” in widget blueprint which is shown like below: but still not working.

Can you post the logs when this happens? The crash report is not explicit enough sometimes. It’s under \YourGame\Saved\Logs

There are many files in that folder. Which one I should post here? For example: Dump-xxxxxxxxx.dmp, MyProject.log, MyProject-backup-yyyy.mm.dd-time.hh.mm.ss.log

.log file. To be sure to send the correct file, close the editor, delete all the files in the Saved/Logs folder, reopen the editor and reproduce your bug. Then, ryou should have the correct .log there.

Here is the file,

MyProject.log

Sorry the Level blueprint will be like shown below:

From your log, you can see that you have a reference to a Seat object that needs to be cleaned.

[2015.02.18-16.07.44:362][226]LogReferenceChain: (root) GCObjectReferencer /Engine/Transient.GCObjectReferencer_0->UE4Editor-CoreUObject.dll!UnknownFunction (0x000007fef2b33770) + 0 bytes [UnknownFile:0]
[2015.02.18-16.07.44:362][226]LogReferenceChain:   Scene2_C /Engine/Transient.UnrealEdEngine_0:GameInstance_0.Scene2_C_0->Seat
[2015.02.18-16.07.44:362][226]LogReferenceChain:     StaticMeshActor /Game/StarterContent/UEDPIE_0_Scene2.Scene2:PersistentLevel.Seat2->Outer
[2015.02.18-16.07.44:362][226]LogReferenceChain:       Level /Game/StarterContent/UEDPIE_0_Scene2.Scene2:PersistentLevel->OwningWorld
[2015.02.18-16.07.44:362][226]LogReferenceChain:         (target) World /Game/StarterContent/UEDPIE_0_Scene2.Scene2
[2015.02.18-16.07.44:433][226]LogLoad:    (Object is not currently rooted)

So that seat reference need to be cleaned. You can put it to null or detraoy or both before switching level. This happens because seat is part of the world that needs to be cleaned.

How to null or destroy the levels? Can you please help?

You need to remove that reference to Seat. In C++ just put it to nullptr.
Where is that Seat Reference? It’s a StaticMeshActor that you have in your scene right? You seem to have a reference on an object that travels between scene. You need to get rid of it.

Yes the Seat Reference is the StaticMeshActor. But how to remove that using blueprint?

You set the value to null. A basic Set, before loading your other level. Or just Destroy the actor. Using a Destroy node in your level blueprint for example.

Hi,

I have tried with “Destroy Actor” and its working fine but the Remove Widget is not working now. I have added “Remove from Parent” almost in every places but its not removing the widget when I change the level. How to solve this?

I don’t know what you are talking about…You need to be more specific if you want help, if it’s another question entirely, you can always create a new one. Also if your previous question is solved, you can mark the answer as “correct” this could help other people that have a similar issue.

I was not sure whether it comes to separate thread. But the actual problem still occurs. So I am posting it here. Since you suggested me to use “Null or Destroy Actor”, I was not sure how to set the value to Null. So I used “Destroy Actor” connected to “EventEndPlay”.

When I add “Destroy Actor”, the widget is not removing properly but the bug is fixed. When I remove “Destroy Actor”, the removing widget is working properly but the bug occurs. Its like vice versa in both case. I dont know what should I do now to fix this.

My blueprint will look like below: I even added “Remove from Parent” in “EventBeginPlay” but the widget is not working properly. It works when I remove “Destroy Actor” in “EventEndPlay” but the bug occurs in this case.

Hello purmo037,

I believe that this is a duplicate post. I have posted an answer on this version of this question. I hope this helps.

Link to duplicate question:

Make it a great day