# Crash in Stats thread on 4.16

**URL:** <https://forums.unrealengine.com/t/crash-in-stats-thread-on-4-16/434660>\
**Category:** C++\
**Tags:** stats, bug, crash-at-startup, unreal-engine, crash, CPP, question\
**Created:** [September 28, 2018, 2:08pm UTC](https://forums.unrealengine.com/t/crash-in-stats-thread-on-4-16/434660 "2018-09-28T14:08:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![msvcrt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@msvcrt](https://forums.unrealengine.com/u/msvcrt)\
**Post date:** [September 28, 2018, 2:08pm UTC](https://forums.unrealengine.com/t/crash-in-stats-thread-on-4-16/434660/1 "2018-09-28T14:08:38Z")

</div>

Hey guys,

I have an old project using UE 4.16.0 that crashes at startup. The crash occurs in Development configuration and doesn’t occur in Debug so this looks like a kind of uninitialized memory issue.

- Project: UE4Game
- Platform: Win32
- Configuration: Development
- LinkType: Modular

Here is the call stack (copied from VS):

> [Inline Frame] UE4-Core.dll!FWindowsPlatformMisc::DebugBreak() Line 57 C++  
> [Inline Frame] UE4-Core.dll!TArray\<FStatPacket \*,FDefaultAllocator\>::CheckAddress(FStatPacket \* const \*) Line 1357 C++  
> [Inline Frame] UE4-Core.dll!TArray\<FStatPacket \*,FDefaultAllocator\>::Add(FStatPacket \* const &) Line 1794 C++  
> [Inline Frame] UE4-Core.dll!FStatsThread::StatMessage(FStatPacket \* Packet) Line 957 C++  
> [Inline Frame] UE4-Core.dll!FStatMessagesTask::DoTask(ENamedThreads::Type) Line 996 C++  
> UE4-Core.dll!TGraphTask::ExecuteTask(TArray\<FBaseGraphTask \*,FDefaultAllocator\> & NewTasks, ENamedThreads::Type CurrentThread) Line 883 C++  
> [Inline Frame] UE4-Core.dll!FBaseGraphTask::Execute(TArray\<FBaseGraphTask \*,FDefaultAllocator\> & CurrentThread, ENamedThreads::Type) Line 488 C++  
> UE4-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 954 C++  
> UE4-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 701 C++  
> UE4-Core.dll!FTaskGraphImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type CurrentThread) Line 1758 C++  
> UE4-Core.dll!FStatsThread::Run() Line 863 C++  
> UE4-Core.dll!FRunnableThreadWin::Run() Line 76 C++  
> UE4-Core.dll!FRunnableThreadWin::GuardedRun() Line 25 C++  
> UE4-Core.dll!FRunnableThreadWin::\_ThreadProc(void \* pThis) Line 78 C++

UPD: There is another crash that seems to be related:

> [Inline Frame] UE4-Core.dll!FWindowsPlatformMisc::DebugBreak() Line 57 C++  
> UE4-Core.dll!FGenericPlatformMemory::OnOutOfMemory(unsigned \_\_int64 Size, unsigned int Alignment) Line 170 C++  
> [Inline Frame] UE4-Core.dll!FMallocBinned2::Private::OutOfMemory(unsigned \_\_int64) Line 271 C++  
> UE4-Core.dll!FMallocBinned2::MallocExternal(unsigned long Size, unsigned int Alignment) Line 688 C++  
> UE4-Core.dll!FMallocBinned2::ReallocExternal(void \* Ptr, unsigned long NewSize, unsigned int Alignment) Line 735 C++  
> UE4-Core.dll!FMallocBinned2::Realloc(void \* Ptr, unsigned long NewSize, unsigned int Alignment) Line 432 C++  
> UE4-Core.dll!FMallocPoisonProxy::Realloc(void \* Ptr, unsigned long NewSize, unsigned int Alignment) Line 67 C++  
> UE4-Core.dll!FMemory::Realloc(void \* Original, unsigned long Count, unsigned int Alignment) Line 34 C++  
> [Inline Frame] UE4-Core.dll!FHeapAllocator::ForAnyElementType::ResizeAllocation(int) Line 385 C++  
> UE4-Core.dll!TArray\<FStatMessage,FDefaultAllocator\>::ResizeGrow(int OldNum) Line 2267 C++  
> [Inline Frame] UE4-Core.dll!TArray\<FStatMessage,FDefaultAllocator\>::AddUninitialized(int) Line 1221 C++  
> UE4-Core.dll!operator new\<FStatMessage,FDefaultAllocator\>(unsigned int Size, TArray\<FStatMessage,FDefaultAllocator\> & Array) Line 2825 C++  
> UE4-Core.dll!FStartupMessages::AddMetadata(FName InStatName, const wchar\_t \* InStatDesc, const char \* InGroupName, const char \* InGroupCategory, const wchar\_t \* InGroupDesc, bool bShouldClearEveryFrame, EStatDataType::Type InStatType, bool bCycleStat, FWindowsPlatformMemory::EMemoryCounterRegion InMemoryRegion) Line 325 C++  
> UE4-Core.dll!FThreadSafeStaticStatBase::DoSetup(const char \* InStatName, const wchar\_t \* InStatDesc, const char \* InGroupName, const char \* InGroupCategory, const wchar\_t \* InGroupDesc, bool bDefaultEnable, bool bShouldClearEveryFrame, EStatDataType::Type InStatType, bool bCycleStat, FWindowsPlatformMemory::EMemoryCounterRegion InMemoryRegion) Line 352 C++  
> [Inline Frame] UE4-Core.dll!FThreadSafeStaticStatInner\<`FStatsThreadState::FindOrAddMetaData'::`5’::FStat\_STAT\_FSimpleDelegateGraphTask\_StatsGroupToGame,1\>::GetStatId() Line 1688 C++  
> UE4-Core.dll!FStatsThreadState::FindOrAddMetaData(const FStatMessage & Item) Line 1745 C++  
> UE4-Core.dll!FStatsThreadState::ProcessMetaDataOnly(TArray\<FStatMessage,FDefaultAllocator\> & Data) Line 804 C++  
> UE4-Core.dll!FStatsThread::Tick() Line 917 C++  
> [Inline Frame] UE4-Core.dll!FStatsThread::StatMessage(FStatPacket \* Packet) Line 960 C++  
> [Inline Frame] UE4-Core.dll!FStatMessagesTask::DoTask(ENamedThreads::Type) Line 996 C++  
> UE4-Core.dll!TGraphTask::ExecuteTask(TArray\<FBaseGraphTask \*,FDefaultAllocator\> & NewTasks, ENamedThreads::Type CurrentThread) Line 886 C++  
> [Inline Frame] UE4-Core.dll!FBaseGraphTask::Execute(TArray\<FBaseGraphTask \*,FDefaultAllocator\> & CurrentThread, ENamedThreads::Type) Line 488 C++  
> UE4-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 954 C++  
> UE4-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 701 C++  
> UE4-Core.dll!FTaskGraphImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type CurrentThread) Line 1758 C++  
> UE4-Core.dll!FStatsThread::Run() Line 863 C++  
> UE4-Core.dll!FRunnableThreadWin::Run() Line 76 C++  
> UE4-Core.dll!FRunnableThreadWin::GuardedRun() Line 25 C++  
> UE4-Core.dll!FRunnableThreadWin::\_ThreadProc(void \* pThis) Line 78 C++

Which of two will appear seems to be random, but one of them always does.
