How to clear world transfer batch in IL2CPP enabled build?
Does this affect the legacy HoloToolkit (master) or the Mixed Reality Toolkit (mrtk_release)? No.
Describe the bug I am not able to clear world anchor transfer batch post serializing even after calling dispose. It doesnt release memory for Il2CPP alone. It is working in .net.
To Reproduce Approach 1
- Take Mrtk Examples.
- Make sure you have sharing with Unet example scene.
- Open UNetAnchorManager.cs class and comment #581, #584. (So as to not save the serialized anchor bytes).
- Profile the memory allocation.
Approach 2 to reproduce:
- Download the project : https://drive.google.com/open?id=1LHXGPlxBOD6BI08UCin0xCQENtAnZ-4L
- Make sure to switch IL2CPP platform if not already.
- Build the MemoryTestScene (Present in MemoryDebugging folder )for IL2CPP and start profiler.
- In HL it places a cube. Tap the cube and it starts serializing process (happens only on first tap).
- Analyze the memory allocation.
- Do the same for DotNet platform and analyze memory.
In dot net memory gets freed but not in IL2CPP. Also all code for serialization are there in TapResponder class.
Expected behavior* Wtb should become null post disposing. Memory should be freed after anchor has been created and it should get freed.
Actual behavior Memory hike noticed during serialization process doesn't get freed even after we are done with the process.
Screenshots If applicable, add screenshots to help explain your problem.
Unity Editor Version Unity 2017.4.6f1
Mixed Reality Toolkit Release Version 2017.4.0
Additional context Add any other context about the problem here.
🤔 might be a bug that needs to be reported to unity?
Could you please will out the issue temple completely with repro steps?
World anchor batch wont clear for us too, using the default sharing example + debug text you can see that it never clears
We just found post debugging that anchorbatch might not be the culprit. The large object Heap occupied by the list of bytes might not be getting freed. In profiler, if we don't save the bytes returned by the world anchor transfer batch, there is not spike in the memory. More debugging in progress.
Please add reproduction steps
@StephenHodgson Apologies. I have added the repro steps.Also, please check the prior comment for latest finding. I beleive it's more of a problem from Unity side. I have reported to them as well.
Just some info for you @StephenHodgson this was actually caused by corrupt anchors on our side, so it could be that other users issues with world anchors / serialisation / import export etc could be related to that.
Once it tried to use in any way a corrupt anchor, a whole ton of problems cascaded down and made it seem like many other systems were having issues (including the world anchor transfer batch not clearing after that point), but it all can be pinpointed (at least on our project) to corrupt anchors, and now we do some simple checks on their size and that mostly stops corrupt anchors getting through
not sure if that helps at all, I know its not as good as repro steps but hopefully will help guide you to the root cause of the issue
Answered! Further questions?
https://stackoverflow.com/questions/tagged/mrtk
@isurfraz Can you please specify what do you mean by corrupt anchors? The pattern i have noticed is the size of anchor varies as per the size of mesh scanned. Is that a problem. In general, serialized anchors were of size 28MB!