Search Issue Tracker
Feature Request
Votes
2
Found in
2022.2.0a16
Issue ID
UUM-1500
Regression
No
Incremental Garbage Collection not working properly on HoloLens 2 (and possibly other XR platforms)
Incremental Garbage Collection is not working properly on the HoloLens 2. I built a customer project with Vsync enabled and Application.targetFrameRate = 60 and I expected to see GarbageCollector.CollectIncremental run within the 16.6ms frame budget (assuming the rest of the CPU work is done in time). What actually happens is that CollectIncremental runs for 0ms per frame (despite the application allocating a fair amount of garbage every frame) and then spikes periodically. For example, the attached screenshot "IncGSStillWeird.PNG" shows a frame where all the other CPU work finished at about 14.6ms, but instead of running GC for 2ms, it runs for 6.27ms.
There's a GC.Collect in the middle, but that doesn't start until after the GC has already blown through the frame budget.
My understanding is that the incremental GC is supposed to run at the end of each frame, which on most platforms is when WaitForTargetFPS runs. But on HoloLens 2 the Vsync marker seems to be called XR.WaitForGPU, and instead of happening at the end of the frame, it happens in between the script updates and the main thread rendering work (see attached file "WaitForGPU.PNG" for a screenshot of this on a different frame from the same capture). This means that by the time we get to the end of the frame, there's no CPU time left to allocate for incremental GC - so it either does nothing, or when it really needs to clean up it runs a full stop-the-world GC.Collect.
Comments (1)
-
BuffChocobo
Jun 14, 2022 00:54
I'm having the same issue in 2020.3.31.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Choosing new HDR Colour using RGB values breaks colour on Intensity Selectors
- Rendering/Decal Layer Mask options are different inside Prefab Mode and outside Prefab Mode when the project is upgraded to Unity 6
- The Shortcuts window cannot be docked when it is invoked from the Shortcut Helper Bar
- Incorrect Realtime GI Light Probes baking when more than one Light Probe Group is used and "Baked Global Illumination" is enabled
- Hovering on the three-dot menu also highlights the tab header near it when not all tabs fit the bar
Resolution Note:
This issue has been converted to a Feature Request. This fix requires planning and extensive testing, and cannot be addressed by a bug fix.