Forum Discussion
lXg99
10 years agoExplorer
App eats memory when HMDUnmounted (Windows)
When my app runs and the HMD is mounted/the sensor covered memory is staying steady(over hours). When i unmount memory gets eaten away until the app crashes ~ 1GB RAM/5 minutes. Is there a memory leak? Or do i have to handle the situation in any way? My installation consists of 5 rifts dangeling from the ceiling in a museum, so there will be quite some Unmounted-Time. Is this a known limitation/bug?
Windows10/64, Runtime 1.7, Unity 5.4.1f1
Windows10/64, Runtime 1.7, Unity 5.4.1f1
22 Replies
Replies have been turned off for this discussion
- vrdavebOculus StaffThis sounds like an instance of https://issuetracker.unity3d.com/issues/googlevr-canvas-are-allocating-memory-and-do-not-release-it-when-using-vr-cameras, which was fixed in 5.4.1p1. Can you update?
- ActiveMeDevExplorerI have a similar issue which is still in Unity 5.4.1p1 with 1.8 runtime on Windows 10/64 using a 32 bits build
After 20 to 60 seconds of Oculus inactivity, the memory start leaking slowly. (1 MB every 1-2 sec) - vrdavebOculus StaffInteresting. Can you PM me a build of your app? We've had other developers with similar issues, but they turned out to be leaked memory in scripts.
- mbzdmvpExplorerI am now noticing the same issue on Windows 10 with Unity 5.3.6p3, it only happens in a standalone build while the headset is unmounted.
- ActiveMeDevExplorerHello vrdaveb,
I've kind of isolated the memory leak and it look like it's coming from skinmeshes.
I made a test project where the memory leak occure with 5MB / sec
I PM you the download link. - ActiveMeDevExplorer
mbzdmvp said:
I am now noticing the same issue on Windows 10 with Unity 5.3.6p3, it only happens in a standalone build while the headset is unmounted.
Does "Run In Background" is checked in your project ? If so can you try to uncheck it ? - ewblaisExplorerI have a memory leak fix that isn't related to skinned meshes coming in Unity 5.4.1p4, 5.4.2f1 and 5.3.6p7. This fixes an issue with Camera and culling when VR is enabled, Run In Background is true, and Oculus HMD loses focus similar to where you are seeing your current leak. I'm going to take a look at the Skinned meshes repro and find the leak there, but you shouldn't see a large amount of memory leaking anymore in builds without skinned meshes. @mbzdmvp try that version of 5.3.6 and see if it helps you. (So long as you aren't using skinned meshes)
- ActiveMeDevExplorerAlright...
In my projects, I have to keep Run in background checked and I use skinned meshes.
It have to run all day long for an event.
I have an Idle scene and the game is limited in time so my current workaround is to callUnityEngine.VR.VRSettings.enabled = false;yield return 0;UnityEngine.VR.VRSettings.enabled = true;
every 15 seconds while the game is on Idle mode. - rhoxExplorerI'm also having an issue with large amounts of leaked memory when the headset is off. The Unity Profiler reports it as 'System Memory', and I don't see any allocations of .NET objects or anything else while it's happening. I've left it off long enough to consume more than 10GB of RAM! As soon as I put the headset back on, the usage drops right back to normal levels.
I think I've been able to associate the leak with the Canvas object (as disabling the Canvas seems to alleviate it,) but I've got a bit of a frustrating workflow because I'm attempting to swap which camera object I'm using depending on if I have a Rift or a Vive attached.
Anyways,
I've tried building on 5.4.1p4, and even 5.5.0b7. The 5.5.0b7 (released Oct 11 2016) has a patch note that says "VR: Fixed memory leak caused by stereo cameras still culling while not rendering. (824508)", and "VR: Updated Oculus plugin to version 1.8.", but none of that seemed to help. (In fact, the memory usage increased *more* rapidly in 5.5.0b7.)
On a whim, I gave prioritizing OpenVR as the default Virtual Reality SDK. When I remove my HMD then, the game on the monitor doesn't go black like it does with the Oculus SDK selected, but my memory usage remains constant.
If this is an issue in the Oculus SDK, I've been unable to track it down so far as to why it's happening. Using OpenVR as the default SDK may work for me for now, but I'm not sure for long term. As well, I don't exactly know what I'm missing out on by not having the Oculus SDK set as default.
Is there anything I could look at to be of more help to track down what may be causing these issues? - vrdavebOculus StaffIn 5.4.1p4, Unity fixed the Canvas leak, but another similar leak was introduced if you are using OVROverlay. Is that the case? If so, please disable the overlay for now or use a 5.3 version. In the upcoming 1.9 release (about 1 week out), we will be shipping a fix for the latter leak.
If the above doesn't help, please send me a build of the app and I'll see if I can root-cause it in the debugger.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device