justiceinc
7 years agoProtege
Where is my RAM? Unity app on Oculus GO non-deterministic crashing with < 1gb memory used!
Been at this for a couple weeks now, so I need help. I have a relatively large app with many features, and recently it started exhibiting crashes, mainly during a new scene load, which made it terrible to track down.
I eventually figured out were due to out-of-memory issues. I had no logs saying this, but doing an adb bugreport eventually showed the culprit as lowmemorykiller ending the process abruptly.
So using Unity's great profiling tools, I was able to get my RAM consumption down from about 2gb to under 1gb. Crashes seemingly abated. Then I went on with other optimizations, including switching from GLES2 to GLES3+Single Pass Rendering. Now the crashes are coming back! I'm not using any more memory, except possibly for GLES3 itself - the profiler shows 1.02gb in use, 0.76 for unity and 270mb for "GfxDriver".
However, I was previously able to have 2gb in memory before crashes before, on GLES2, so why would I crash now at ~1gb on GLES3? Further, the crashes are not consistent - sometimes I can play everything fine with no crashes, other times not. Sometimes, simply connecting to the Unity profiler pushes me over the edge to a crash, further complicating my debugging process. If I'm interpreting things correctly, the profiler says (right before the crash) that I'm using 1.02gb out of "reserved" 1.05gb, and that 2.40gb "total system memory usage" - so what is using the extra 1.4gb?
Is there any better way I can isolate the specific causes of the issue? I really can't do much more to manage my RAM usage. Half of it is out of my control - 270mb on the graphics driver, and 200mb for the eye render textures - and it just feels like every time I lower my memory usage a bit, the point where I get a crash becomes lower to compensate. If I can't get an answer I'll just have to go back to the inexplicably working GLES2, and lose single-pass rendering, but that will lead to degraded user experience, so please send any suggestions! Thanks