"index < m_size" Crash

I’ve seen this error before on Windows Store (Phone & Windows RT,) but it generally wasn’t a fatal error. It was sufficient usually to switch to Master release mode and ignore the error. It’s not present on any other platforms.

With the latest app I’m porting in Unity, I now consistently receive this error message in the console prior to a hard crash on Windows Phone. It’s generally preceded by an unused memory cleanup:

Unloading 43 unused Assets to reduce memory usage. Loaded Objects now: 10718. Operation took 968.524536 ms.

System memory in use: 39.0 MB.

index < m_size

(Filename: C:\buildslave\unity\build\Runtime/Utilities/dynamic_array.h Line: 303)

I can’t find any documentation on where this log message comes from, I’d be grateful to know where in the Unity code this message can be produced as I have no idea where to start looking nor can I seem to catch this with a breakpoint.

I may have managed to find the call stack for the exception, I think?

>    UnityPlayer.dll!dynamic_array<struct SceneNode,4>::operator[](unsigned int)    Unknown
    UnityPlayer.dll!Unity::RendererScene::NotifyInvisible(void)    Unknown
    UnityPlayer.dll!PlayerLoop(bool,bool,class IHookEvent *)    Unknown
    UnityPlayer.dll!metro::MainLoop(bool)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::MetroMainLoop(void)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::smile:oPerformUpdateAndRender(void)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::PerformUpdateAndRender(void)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThreadImplementation(void *)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThread(void *)    Unknown
    UnityPlayer.dll!<lambda>(void)()    Unknown
    UnityPlayer.dll!Platform::smile:etails::__abi_FunctorCapture<class <lambda_2aa9310133913358153453d9e5d5d831>,void,struct Windows::Foundation::IAsyncAction ^>::Invoke(struct Windows::Foundation::IAsyncAction ^)    Unknown
    UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::Invoke(struct Windows::Foundation::IAsyncAction ^)    Unknown
    UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::[Windows::System::Threading::WorkItemHandler::__abi_IDelegate]::__abi_Windows_System_Threading_WorkItemHandler___abi_IDelegate____abi_Invoke(struct Windows::Foundation::IAsyncAction ^)    Unknown
    THREADPOOLWINRT.DLL!Windows::System::Threading::CThreadPoolWorkItem::CommonWorkCallback(void)    Unknown
    THREADPOOLWINRT.DLL!Windows::System::Threading::CThreadPoolWorkItem::TimeSlicedCallback(void *)    Unknown
    NTDLL.DLL!RtlUserThreadStart()    Unknown

edit: it’s quickly followed by another exception:

>    UnityPlayer.dll!dynamic_array<unsigned char,1>::operator[](unsigned int)    Unknown
    UnityPlayer.dll!Unity::RendererScene::NotifyInvisible(void)    Unknown
    UnityPlayer.dll!PlayerLoop(bool,bool,class IHookEvent *)    Unknown
    UnityPlayer.dll!metro::MainLoop(bool)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::MetroMainLoop(void)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::smile:oPerformUpdateAndRender(void)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::PerformUpdateAndRender(void)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThreadImplementation(void *)    Unknown
    UnityPlayer.dll!UnityPlayer::AppCallbacks::_AppThread(void *)    Unknown
    UnityPlayer.dll!<lambda>(void)()    Unknown
    UnityPlayer.dll!Platform::smile:etails::__abi_FunctorCapture<class <lambda_2aa9310133913358153453d9e5d5d831>,void,struct Windows::Foundation::IAsyncAction ^>::Invoke(struct Windows::Foundation::IAsyncAction ^)    Unknown
    UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::Invoke(struct Windows::Foundation::IAsyncAction ^)    Unknown
    UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::[Windows::System::Threading::WorkItemHandler::__abi_IDelegate]::__abi_Windows_System_Threading_WorkItemHandler___abi_IDelegate____abi_Invoke(struct Windows::Foundation::IAsyncAction ^)    Unknown
    THREADPOOLWINRT.DLL!Windows::System::Threading::CThreadPoolWorkItem::CommonWorkCallback(void)    Unknown
    THREADPOOLWINRT.DLL!Windows::System::Threading::CThreadPoolWorkItem::TimeSlicedCallback(void *)    Unknown
    NTDLL.DLL!RtlUserThreadStart()    Unknown

Having this same exact error on Windows 10 Universal. It happens whether I’m running XAML or D3D, or .NET or IL2CPP. No idea where it’s coming from.

After poking around in the debugger a bit I found a callstack. It looks like it happens in GameObject.Instantiate, specifically when instantiating something with an Animator.

Btw, I also had this issue on the Xbox One, and I think I fixed it by updating Unity. Obviously not an option with UWP and IL2CPP. :stuck_out_tongue:

The top of the callstack:

UnityPlayer.dll!dynamic_array<unsigned char,1>::operator[ ](unsigned __int64) Unknown
UnityPlayer.dll!UnityEngine::Animation::RegisterAvatarBindingObjects(struct UnityEngine::Animation::AvatarBindingConstant *) Unknown
UnityPlayer.dll!UnityEngine::Animation::CreateAnimatorGenericBindingsOpt(struct UnityEngine::Animation::AnimationSetBindings const &,class Transform &,struct mecanim::animation::AvatarConstant const *,struct mecanim::animation::ControllerConstant const *,struct UnityEngine::Animation::AvatarBindingConstant const *,bool,class mecanim::memory::Allocator &,class Animator &) Unknown
UnityPlayer.dll!Animator::SetupBindingsDataSet(struct mecanim::animation::ControllerConstant const *,struct UnityEngine::Animation::AnimationSetBindings const *,struct Animator::BindingsDataSet &,struct Animator::AvatarDataSet &) Unknown
UnityPlayer.dll!Animator::CreateBindings(void) Unknown
UnityPlayer.dll!Animator::CreateObject(void) Unknown
UnityPlayer.dll!Animator::Rebind(void) Unknown
UnityPlayer.dll!Animator::AwakeFromLoad(enum AwakeFromLoadMode) Unknown
UnityPlayer.dll!AwakeFromLoadQueue::InvokeAwakeFromLoad(struct AwakeFromLoadQueue::Item *,unsigned int,enum AwakeFromLoadMode) Unknown
UnityPlayer.dll!AwakeFromLoadQueue::AwakeFromLoad(enum AwakeFromLoadMode,bool) Unknown
UnityPlayer.dll!AwakeAndActivateClonedObjects(class vector_map<int,int,struct std::less,class stl_allocator<struct std::pair<int,int>,1,16> > const &) Unknown
UnityPlayer.dll!InstantiateObject(class Object &,class Vector3f const &,class Quaternionf const &) Unknown
UnityPlayer.dll!Object_CUSTOM_INTERNAL_CALL_Internal_InstantiateSingle(struct ReadOnlyScriptingObjectOfType,class Vector3f const &,class Quaternionf const &) Unknown

UnityPlayer.dll!Object_INTERNAL_CALL_Internal_InstantiateSingle_m9_897(Object_t * __this, Object_t9_5 * ___data, Vector3_t9_54 * ___pos, Quaternion_t9_56 * ___rot, const MethodInfo * method) Line 953 C++
UnityPlayer.dll!Object_Internal_InstantiateSingle_m9_896(Object_t * __this, Object_t9_5 * ___data, Vector3_t9_54 ___pos, Quaternion_t9_56 ___rot, const MethodInfo * method) Line 941 C++
UnityPlayer.dll!Object_Instantiate_m9_920(Object_t * __this, Object_t9_5 * ___original, Vector3_t9_54 ___position, Quaternion_t9_56 ___rotation, const MethodInfo * method) Line 1248 C++
UnityPlayer.dll!StaticScriptCommands_SpawnCharacter_m13_1855(Object_t * __this, String_t * ___characterID, Transform_t9_73 * ___locator, const MethodInfo * method) Line 18968 C++

bug report please with repro project, thank you

This is an assert firing - Unity’s trying to read outside of array bounds. This is definitely a bug. We’ll need a bug report in order to investigate to even tell what’s causing it, though.

Finally narrowed this down. Submitted as bug (Case 751974) with a repro project. Turns out it was only happening in debug mode, so fortunately I’m unblocked for now.

1 Like