UE 5.3.2 crash while executing TArray destructor [File:\Engine\Source\Runtime\Core\Public\Containers\Array.h] [Line: 692]

Hello everyone! Recently I got a strange issue and I don’t know how to fix and reproduce it… This happens randomly from time to time. In TArray destructor:

/** Destructor. /
~TArray()
{
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
#if defined(_MSC_VER) && !defined(clang) // Relies on MSVC-specific lazy template instantiation to support arrays of incomplete types
// ensure that DebugGet gets instantiated.
// this is done to ensure DebugGet is available for the debugger watch window
//@todo it would be nice if we had a cleaner solution for DebugGet
volatile const ElementType
Dummy = &DebugGet(0);
#endif
#endif

DestructItems(GetData(), ArrayNum); // Exception thrown: read access violation.

this was 0xFFFFFFFFFFFFFFF7.

// note ArrayNum, ArrayMax and data pointer are not invalidated
// they are left unchanged and use-after-destruct will see them the same as before destruct

}

call stack:

UnrealEditor-Engine.dll!TArray<TDelegateBase,TSizedHeapAllocator<32,FMemory>>:: ~TArray<TDelegateBase,TSizedHeapAllocator<32,FMemory>>() Line 692
UnrealEditor-Engine.dll!FBodyInstance::~FBodyInstance() Line 357
UnrealEditor-Engine.dll!UPrimitiveComponent::~UPrimitiveComponent() Line 283
UnrealEditor-Engine.dll!UStaticMeshComponent::`vector deleting destructor’(unsigned int)
UnrealEditor-CoreUObject.dll!FAsyncPurge::TickDestroyGameThreadObjects(bool bUseTimeLimit, double TimeLimit, double StartTime) Line 566
[Inline Frame] UnrealEditor-CoreUObject.dll!FAsyncPurge::TickPurge(bool StartTime, double) Line 688
UnrealEditor-CoreUObject.dll!IncrementalDestroyGarbage(bool bUseTimeLimit, double TimeLimit) Line 4261
UnrealEditor-CoreUObject.dll!IncrementalPurgeGarbage(bool bUseTimeLimit, double TimeLimit) Line 3957
UnrealEditor-Engine.dll!UEngine::ConditionalCollectGarbage() Line 1848
UnrealEditor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1716
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1714
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 531
UnrealEditor.exe!FEngineLoop::Tick() Line 5825
[Inline Frame] UnrealEditor.exe!EngineTick() Line 61
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 188
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * formal, int nCmdShow, const wchar_t * CmdLine) Line 247
UnrealEditor.exe!WinMain(HINSTANCE
* hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 298
[Inline Frame] UnrealEditor.exe!invoke_main() Line 102
UnrealEditor.exe!__scrt_common_main_seh() Line 288
kernel32.dll!00007ff9bf39257d()
ntdll.dll!00007ff9c158aa58()

It would be great if someone could help me :frowning:

2 Likes

I also encountered this problem, have you solved it?

I also have the same issue. It’s so random when it crashes that I haven’t been able to figure out what exactly causes it. Sometimes same exact code crashes, sometimes it doesn’t.

It always happens on StaticMeshComponent.

Has anyone been able to figure this one out?

So after several days of banging my head against a wall I managed to fix the problem.

Even though the crashes seemed random, I started noticing a pattern. It was always the same 3-5 blueprints that kept crashing.

Then later while googling I came upon a post by a person. This post reminded me of an issue I had faced several years ago - CDO(class default object) corruption.

This can happen when you make changes to a header file and then use hot reload or live coding to compile. You MUST close the editor, compile the code and only then run UE again. This is a well documented issue.

The most insidious thing about this is that after you make this mistake you might not notice any issues for weeks, months to come. So you go “oh this worked, great”. And keep going about your development.

Then when it does start crashing in unexplainable ways months later - it is extremely hard to debug, cause naturally you think it must be some recent changes you made.

Here’s the fix:

  1. Identify the blueprints that have been corrupted.
  2. Delete them. Destroy them. Burn them to the ground.
  3. Re-create fresh ones.
  4. NEVER use hot reloads and live coding for any significant changes to your code.

If step 2 fails. Which there is a good chance it will. Every time I tried to delete mine - the editor kept crashing on me. Only way I was able to do it was to remove some classes from c++ first and recompile.