Magical Garbage Collection gets invalid Array from ArrayPool and crashes

Hi,

Unreal is hitting a break point at FastReferenceCollector.h:290 but there is no error message and I dont know where to fix stuff. This is the snippet where it happens:

else if (ReferenceInfo.Type == GCRT_ArrayObject)
{
	// We're dealing with an array of object references.
	TArray<UObject*>& ObjectArray = *((TArray<UObject*>*)(StackEntryData + ReferenceInfo.Offset));
	TokenReturnCount = ReferenceInfo.ReturnCount;
	for (int32 ObjectIndex = 0, ObjectNum = ObjectArray.Num(); ObjectIndex < ObjectNum; ++ObjectIndex)
	{
		ReferenceProcessor.HandleTokenStreamObjectReference(NewObjectsToSerialize, CurrentObject, ObjectArray[ObjectIndex], ReferenceTokenStreamIndex, true);
	}
}

At ReferenceProcessor.HandleTokenStreamObjectReference(...) the break point is hit with NewObjectsToSerialize being Invalid . Sometimes the Name of CurrentObject is also Invalid, but not always.
The NewObjectsToSerialize are coming from *ArrayPool.GetArrayFromPool() and ArrayPool is a template Type.

What I also noticed is that in the else if the ReferenceInfo.Type says it’s 8 while the GCRT_ArrayObject is 3.

To me it looks like the GC is trying to clean something that isn’t there and then crashes. What is actually happening in this part of the GC?

I have the same problem, OgoxHammerschild, did you find any solution?

Hi Santor,

I didn’t find a solution for that, but in my case this error disappeared somehow over night with no concrete reason.

When I had the error I was thinking that it may have something to do with en-/disabling of actors, like you do in an object pool. Maybe Unreal GC thought “oh, you disabled this actor? you sure don’t need it anymore, right? let me take care of it”. but then enable the actor regardless, but it’s already gone…

It may also be that there is a single pointer to an actor and another pointer to the same actor inside an array and one of them was deleted but the other pointer still points to the deleted actor/object and just returns invalid rubbish.

But I can just guess… In the end, I don’t have a clue what is causing this error. Sorry :frowning:

I’m also getting this issue, did any of you find a solution or a way to debug it?