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.

  1. 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.

Comments (1)

  1. BuffChocobo

    Jun 14, 2022 00:54

    I'm having the same issue in 2020.3.31.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.