This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
Every time a MotionController is detected, it's corresponding model is loaded, resulting in 5,5 MB of garbage every time.
Times this happens when returning to the game include:
opening Native Menu
Gazing at the Native Keyboard
the keyboard is the actual problem here, because it happens EVERY TIME you point at and then away from it
Doing this too often eventually leads to a heap overflow
DynamicHeapAllocator allocation probe 1 failed - Could not get memory for large allocation 5592408.
DynamicHeapAllocator allocation probe 2 failed - Could not get memory for large allocation 5592408.
DynamicHeapAllocator allocation probe 3 failed - Could not get memory for large allocation 5592408.
DynamicHeapAllocator allocation probe 4 failed - Could not get memory for large allocation 5592408.
DynamicHeapAllocator out of memory - Could not get memory for large allocation 5592408!
Could not allocate memory: System out of memory!
Trying to allocate: 5592408B with 16 alignment. MemoryLabel: Texture
Allocation happened at: Line:75 in C:\buildslave\unity\build\Runtime/Utilities/dynamic_array.h
Memory overview
[ ALLOC_DEFAULT ] used: 39511616B | peak: 0B | reserved: 47185920B
[ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 2097152B
[ ALLOC_TEMP_BACKGROUND_JOB ] used: 0B | peak: 0B | reserved: 1048576B
[ ALLOC_GFX ] used: 824509364B | peak: 0B | reserved: 827326856B
[ ALLOC_CACHEOBJECTS ] used: 1502212B | peak: 0B | reserved: 10485760B
[ ALLOC_TYPETREE ] used: 0B | peak: 0B | reserved: 0B
[ ALLOC_PROFILER ] used: 849812B | peak: 849812B | reserved: 4194304B
[ ALLOC_TEMP_THREAD ] used: 32768B | peak: 0B | reserved: 3997696B
Could not allocate memory: System out of memory!
Trying to allocate: 5592408B with 16 alignment. MemoryLabel: Texture
Allocation happened at: Line:75 in C:\buildslave\unity\build\Runtime/Utilities/dynamic_array.h
Memory overview
[ ALLOC_DEFAULT ] used: 39511616B | peak: 0B | reserved: 47185920B
[ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 2097152B
[ ALLOC_TEMP_BACKGROUND_JOB ] used: 0B | peak: 0B | reserved: 1048576B
[ ALLOC_GFX ] used: 824509364B | peak: 0B | reserved: 827326856B
[ ALLOC_CACHEOBJECTS ] used: 1502212B | peak: 0B | reserved: 10485760B
[ ALLOC_TYPETREE ] used: 0B | peak: 0B | reserved: 0B
[ ALLOC_PROFILER ] used: 849812B | peak: 849812B | reserved: 4194304B
[ ALLOC_TEMP_THREAD ] used: 32768B | peak: 0B | reserved: 3997696B
UnityEngine.ImageConversion:LoadImage(Texture2D, Byte[])
Microsoft.MixedReality.Toolkit.Utilities.Gltf.Serialization.<ConstructTextureAsync>d__21:MoveNext()
System.Runtime.CompilerServices.MoveNextRunner:InvokeMoveNext(Object)
System.Action`1:Invoke(T)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Runtime.CompilerServices.MoveNextRunner:Run()
DG.Tweening.TweenCallback:Invoke()
Microsoft.MixedReality.Toolkit.Utilities.AwaiterExtensions:RunOnUnityScheduler(Action)
Microsoft.MixedReality.Toolkit.Utilities.SimpleCoroutineAwaiter:Complete(Exception)
Microsoft.MixedReality.Toolkit.Utilities.<ReturnVoid>d__0:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[C:\buildslave\unity\build\Runtime/Allocator/MemoryManager.cpp line 1161]
(Filename: C:\buildslave\unity\build\Runtime/Allocator/MemoryManager.cpp Line: 1161)
To reproduce
Steps to reproduce the behavior:
Deploy and Run a MRTK scene natively on MixedRealityPortal
Open the native keyboard and gaze at and away from it like crazy until the app crashes
Read the player log and notice "Creating controller model from platform SDK" being printed every time you came back, effectively calling the CreateControllerModelFromPlatformSDK method loading the model.
Expected behavior
the model is loaded once and cached
Your Setup (please complete the following information)
Unity Version 2018.4.2f1
MRTK mrtk_development
Target Platform (please complete the following information)
In HTK, we cached the model based on a custom key used to identify the controller type. I worked on a version of that for MRTK but hadn't finished it up yet. I can add it to my backlog.
Describe the bug
Every time a MotionController is detected, it's corresponding model is loaded, resulting in 5,5 MB of garbage every time. Times this happens when returning to the game include:
the keyboard is the actual problem here, because it happens EVERY TIME you point at and then away from it
Doing this too often eventually leads to a heap overflow
To reproduce
Steps to reproduce the behavior:
Expected behavior
the model is loaded once and cached
Your Setup (please complete the following information)
Target Platform (please complete the following information)