Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Memory Error Occurs ~2hrs into Execution

Discussion in 'Editor & General Support' started by JediZebra101, Feb 22, 2021.

  1. JediZebra101

    JediZebra101

    Joined:
    Nov 7, 2016
    Posts:
    5
    Hey all,

    I'm having an issue that crashes the Unity Player (my game) about 2 hours into the game. This time window is fairly consistent. I've checked for memory leaks, but have not noticed anything major. For example, for the first 1.5 hours, the memory usage is essentially stable at < 2GB, and we haven't really detected any memory creep. It seems like a bad location is being accessed.

    Attached the stack trace of the crash report (DMP) file below. Even just a rough concept of what unity features could be breaking here would be helpful, as I think I could work around it. It appears to be UI related, but I don't know much about Unity's internals.

    We're using 2019.4.0.0f1

    Thanks for your help,
    -john

    Unhandled exception at 0x78C2CD0D (UnityPlayer.dll) in crash.dmp: 0xC0000005: Access violation writing location 0x003FFFF0.

    > UnityPlayer.dll!DynamicHeapAllocator::Allocate(unsigned int,int) Unknown
    UnityPlayer.dll!DynamicHeapAllocator::Reallocate(void *,unsigned int,int) Unknown
    UnityPlayer.dll!DualThreadAllocator<class DynamicHeapAllocator>::Reallocate(void *,unsigned int,int) Unknown
    UnityPlayer.dll!MemoryManager::Reallocate(void *,unsigned int,unsigned int,struct MemLabelId const &,enum AllocateOptions,char const *,int) Unknown
    UnityPlayer.dll!realloc_internal(void *,unsigned int,unsigned int,struct MemLabelId const &,enum AllocateOptions,char const *,int) Unknown
    UnityPlayer.dll!dynamic_array_detail::dynamic_array_data::grow(unsigned int,unsigned int) Unknown
    UnityPlayer.dll!dynamic_array<struct UI::UIInstruction,0>::grow(void) Unknown
    UnityPlayer.dll!UI::AddCanvasRendererToCanvas(struct JobFence &,struct UI::CanvasHandle *,struct UI::CanvasData &,int) Unknown
    UnityPlayer.dll!UI::CanvasRenderer::AttachToCanvas(struct JobFence &,class UI::Canvas *,enum UI::CanvasRenderer::InstructionType) Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::AddRenderersToCanvas() Unknown
    UnityPlayer.dll!UI::Canvas::UpdateBatchOrder(void) Unknown
    UnityPlayer.dll!UI::Canvas::UpdateBatches(bool) Unknown
    UnityPlayer.dll!`UI::InitializeCanvasManager'::`2'::UIEventsWillRenderCanvasesRegistrator::Forward() Unknown
    UnityPlayer.dll!`InitPlayerLoopCallbacks'::`2'::postLateUpdatePlayerUpdateCanvasesRegistrator::Forward() Unknown
    UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *) Unknown
    UnityPlayer.dll!ExecutePlayerLoop(struct NativePlayerLoopSystem *) Unknown
    UnityPlayer.dll!PlayerLoop(void) Unknown
    UnityPlayer.dll!PerformMainLoop() Unknown
    UnityPlayer.dll!MainMessageLoop() Unknown
    UnityPlayer.dll!UnityMainImpl(struct HINSTANCE__ *,struct HINSTANCE__ *,wchar_t *,int) Unknown
    UnityPlayer.dll!_UnityMain() Unknown
    Lilith.exe!_wWinMain@16() Unknown
    Lilith.exe!__scrt_common_main_seh() Unknown
    kernel32.dll!@BaseThreadInitThunk@12() Unknown
    ntdll.dll!__RtlUserThreadStart() Unknown
    ntdll.dll!__RtlUserThreadStart@8() Unknown
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    This certainly seems pretty deep in the bowels, in the allocator. It almost feels like something in the allocator crashed, and since I think it's supposed to be managed, that's not supposed to happen and isn't something you would have any control over.
     
  3. JediZebra101

    JediZebra101

    Joined:
    Nov 7, 2016
    Posts:
    5
    Yeah, I'm usually pretty good at debugging my work & getting to the bottom of things, but this one is giving me a hard time. It seems like Unity itself is crashing -- which is fine -- but I have no real link back to a place in my code. I suspect, that ultimately I am doing something weird with the UI -- to get it into this state, but I really don't even know where to start looking. I'm probably just going to start disabling features 1 by 1 until the crash does not happen. Unfortunately, this will take ~2hrs per feature. (I hope I'm good at guessing... haha).
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    Going on the theory that it is UI-related, can you modify and automate the game to aggressively do the things that you might do with UI over the course of a 2-hr game? Like just go nuts popping UI parts open, closed, sliding, etc. and just start it and leave it unattended to crash perhaps faster?
     
  5. JediZebra101

    JediZebra101

    Joined:
    Nov 7, 2016
    Posts:
    5
    Yeah I actually have done this to some extent -- but no luck.