TvEgNUP Posted June 29, 2018 Share Posted June 29, 2018 Hey guys. Where should I report GC allocations to make sure they will be fixed in upcoming SDK updates? I found these allocations which occur every frame, allocating for GC at the rate of 1.6 KB per frame: Class: WaveVR\Scripts\WaveVR_Render.cs Method: private IEnumerator RenderLoop() Line: var wait = new WaitForEndOfFrame(); This allocates heap memory each time WaitForEndOfFrame instance is created. Please cache it at the private class field and instantiate only once, then just reuse: private WaitForEndOfFrame cachedWaitForEndOfFrame;// ...private IEnumerator RenderLoop(){ if (cachedWaitForEndOfFrame == null) { cachedWaitForEndOfFrame = new WaitForEndOfFrame(); } yield return cachedWaitForEndOfFrame; // ....} Class: WaveVR\Scripts\WaveVR_Render.cs Method: private void RenderEye(Camera camera, WVR_Eye eye) Lines: WaveVR_Utils.Trace.BeginSection("Render_" + eye);Log.gpl.d(LOG_TAG, "Render_" + eye); String concatenation implicitly leads to the String.Concat() call and it allocates memory on heap too. Please avoid string concatenation each frame, and cache concatenated value for reuse outside the main loop. Class: WaveVR\Scripts\WaveVR_Distortion.cs Method: public void RenderEye(WVR_Eye eye, RenderTexture texture) Line: WaveVR_Utils.Trace.BeginSection("Distortion_" + eye); Same as previous, string concatenation. please let me know if it's possible to pass this to the Unity plugin devs, as per-frame allocations absence is very crucial for the smoothness of the VR experience - unfortunately Unity still uses old GC which collects garbage on main thread and this takes a lot of time leading to the performance drops (cpu usage spikes) which is very noticeable when doing anything in VR. Thanks! Link to comment Share on other sites More sharing options...
Tony PH Lin Posted July 3, 2018 Share Posted July 3, 2018 Thanks for your suggestions regarding to GC. Yes, we also observe internally and have fixed on code base. It will be included on next release (target the end of July) Link to comment Share on other sites More sharing options...
musk Posted June 13, 2019 Share Posted June 13, 2019 I'm still getting 2.2KB of garbage generated every frame by the RenderLoop coroutine (using WaveSDK 3.0.2) when testing on the headset. It is the only source of garbage collection at runtime in my project, and it causes dropped frames every couple seconds, so it's very important to fix this. What's your ETA on this fix? Link to comment Share on other sites More sharing options...
musk Posted July 15, 2019 Share Posted July 15, 2019 Link to comment Share on other sites More sharing options...
Tony PH Lin Posted July 16, 2019 Share Posted July 16, 2019 Hi , We've reduced the number from several KByte to hundred Byte level. The fix will be ready in Wave 3.1 coming the end of this month. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.