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.
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
- Crash on GizmoDrawingPhysics2D::DrawCompositeCollider2DGizmo when opening a Scene that has corrupted GameObjects with Tilemap Components
- Scrolling vertically and horizontally is very fast when in Play Mode and RuntimeInputBackend is set to UIToolkitInputBackendOption.Default
- Crash on MemoryProfiler::UnregisterAllocation when initializing entities and leaving Play Mode with Occlusion Culling enabled
- Crash on mdb_page_alloc when opening a project that was running while the PC shut down
- macOS Player freeze when using RunInBackground and Command+Tabbing to and from the application
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.