microsoft / MixedRealityToolkit-Unity

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
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

OutOfMemoryException when exporting anchors #168

Closed meng-hui closed 7 years ago

meng-hui commented 8 years ago

When using the Sharing components, OutOfMemoryException is thrown by ImportExportAnchorManager. I just simply modified the Holograms 240 example to include my own content. Are there any workarounds to this?

The logs are below.

OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.List`1.set_Capacity(Int32 value)
   at System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at ImportExportAnchorManager.WriteBuffer(Byte[] data)
   at UnityEngine.VR.WSA.Sharing.WorldAnchorTransferBatch.InvokeWorldAnchorSerializationDataAvailableDelegate(SerializationDataAvailableDelegate onSerializationDataAvailable, Byte[] data)
   at UnityEngine.VR.WSA.Sharing.WorldAnchorTransferBatch.$Invoke18(Int64 instance, Int64* args)
   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method) 
(Filename: <Unknown> Line: 0)
OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.List`1.ToArray()
   at ImportExportAnchorManager.ExportComplete(SerializationCompletionReason status)
   at UnityEngine.VR.WSA.Sharing.WorldAnchorTransferBatch.InvokeWorldAnchorSerializationCompleteDelegate(SerializationCompleteDelegate onSerializationComplete, SerializationCompletionReason completionReason)
   at UnityEngine.VR.WSA.Sharing.WorldAnchorTransferBatch.$Invoke17(Int64 instance, Int64* args)
   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method) 
(Filename: <Unknown> Line: 0)
jwittner commented 8 years ago

Can you reproduce this outside of Holograms 240?

NeerajW commented 8 years ago

You can try to repro with this test scene as well: https://github.com/Microsoft/HoloToolkit-Unity/blob/master/Assets/HoloToolkit/Sharing/Tests/Sharing.unity

jwittner commented 7 years ago

@meng-hui I ran the sharing scenes today without any issues. Maybe I'm missing something - any more details on what content you added?

NeerajW commented 7 years ago

Please reopen with more information if you see this again.