Showing results for 
Search instead for 
Did you mean: 

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

Honored Guest
I have the same problem. A huge amount of features fail because of memory shortage, and there's practically nothing in my scene. 

I've been working on this problem 10 hours now, trying frantically to delete stuff from my project that seem to be compiled, but is never used. Nothing helps.    Does someone have a solution to this problem.

I've tried cutting everything that takes up space like textures and audio out, but it doesn't help. Just a 1000 verts with a simple material on will still crash the app.

@justiceinc are you using ASTC compression for textures?

This is still a huge issue. It appears that Unity, on Oculus Go and Quest, pre-allocates 2.2 GB in an empty project! Further, some memory allocations (ex: new Texture2D) allocate outside of this reserved 2.2 GB and eventually causes the device to run out of memory. I am crashing by "running out of memory" when I'm only actively using 600 MB! 

We never figured out the issue, but managed to lower our quality enough to stop the crashes. Also, sometimes we see issues when changing scenes, as if it was using memory from the old and new scenes, so added an empty "filler" scene between such transitions. But the fact that we have no idea why this happens made it more a game of whack-a-mole than actual debugging. And yes bkj, we're using forced ASTC textures for Go builds. Good luck all!

PS - I'd still love to know where all this memory is going, but thanks to GCCooper we could investigate whether it's actually Unity's fault