Quest 2 - OPENGL NATIVE PLUG-IN ERROR: GL_OUT_OF_MEMORY

Hi,

I only get this OpenGL memory error on the Quest 2, not the Quest 1, despite the same memory usage for both headset.

OPENGL NATIVE PLUG-IN ERROR: GL_OUT_OF_MEMORY: Not enough memory left to execute command

I get this error after changing scenes multiple times, as if the memory used by OpenGL is not getting cleared, despite OVR Metrics telling me that the memory is being cleared via the Used Memory statistic.

My Oculus Quest game uses about 2 gb of ram, with 1.9 gb of Available Memory (according to OVR Metrics) when I get this error.

Here is the full adb logcat stack for the error:

10-15 18:38:30.565 10993 11075 E Unity   : Could not allocate memory: System out of memory!
10-15 18:38:30.565 10993 11075 E Unity   : Trying to allocate: 89478512B with 16 alignment. MemoryLabel: Texture
10-15 18:38:30.565 10993 11075 E Unity   : Allocation happened at: Line:78 in
10-15 18:38:30.565 10993 11075 E Unity   : Memory overview
10-15 18:38:30.565 10993 11075 E Unity   :
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_THREAD ] used: 168236B | peak: 0B | reserved: 2785280B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_1_FRAME ] used: 0B | peak: 0B | reserved: 3145728B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_2_FRAMES ] used: 0B | peak: 0B | reserved: 1048576B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_4_FRAMES ] used: 0B | peak: 0B | reserved: 2097152B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_ASYNC ] used: 43333337B | peak: 0B | reserved: 77594624B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_DEFAULT ] used: 140247130B | peak: 145943275B | reserved: 142429470B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_GAMEOBJECT ] used: 1705614B | peak: 4918456B | reserved: 1722220B
10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_GFX ] used: 429598681B | peak: 518361205B | reserved: 429610480B
10-15 18:38:30.565 10993 11075 E Unity   :
10-15 18:38:30.565 10993 11075 E Unity   :  #0 0xc7fe0539 (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #1 0xc86bf5a7 (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #2 0xc8020c69 (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #3 0xc801f24d (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #4 0xc801f561 (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #5 0xc801f50d (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #6 0xc81154b5 (libunity.so) ? 0x0
10-15 18:38:30.565 10993 11075 E Unity   :  #7 0xc7e22eb9 (libunity.
10-15 18:38:31.255 10993 11046 E Unity   : OPENGL NATIVE PLUG-IN ERROR: GL_OUT_OF_MEMORY: Not enough memory left to execute command
10-15 18:38:31.255 10993 11046 E Unity   : (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 354)
10-15 18:38:31.255 10993 11046 E Unity   :

This is then spammed in the logcat after the error:

10-18 20:04:42.830 18979 19024 E Adreno-GSL: <gsl_memory_alloc_pure:2585>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
10-18 20:04:42.840 18979 19024 W Adreno-GSL: <sharedmem_gpuobj_alloc:2736>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory

The 89 mb texture is a correct size, as my game uses many 89 mb 8k ASTC 4x4 textures. My game uses a lot of memory, but is still within memory limits, and works fine on the Quest 1. So the Quest 2 should be handling it even better.

And here is my VrApi stats:

VrApi   : FPS=72,Prd=49ms,Tear=0,Early=55,Stale=11,VSnc=1,Lat=1,Fov=0,CPU4/GPU=2/2,1171/441MHz,OC=FF,TA=0/0/0,SP=N/N/N,Mem=1555MHz,Free=1830MB,PSM=0,PLS=0,Temp=28.2C/0.0C,TW=1.93ms,App=5.60ms,GD=0.00ms,CPU&GPU=12.46ms,LCnt=1,GPU%=0.57,CPU%=0.41(W0.50),DSF=1.00

So it seems like I still have 1.830 gb of free memory?

I would think that I shouldn’t be having any memory issues, given my 2 gb memory usage and 1.9 gb Availble Memory, and especially not on the Quest 2.

I get this error on the Quest 2 even when using the exact same Quality Settings as for the Quest 1, so it shouldn’t be an issue due to different texture filtering settings, or MSAA, etfc.

I’m using Unity 2019.4.12f, Standard RP, OVRPlugin 1.51.

Anyone else running into this isuse ONLY on the Quest 2?

2 Likes

I do! 2019.4.7 and having similar issues. I just use adb to debug, so I can’t tell if the GL error is exactly the same.
But after trying to load a scene asynchronously, the app just crashes, and the CMD throws a “system out of memory” warning. Something that didn’t happen on Quest 1.
Nowadays, being Quest 2 so new, it’s difficult to find intel in the web. Hope someone at Unity could take a peek on this.

@hungrybelome @carcasanchez I also have a Quest 2 only crash, I started another thread because it looks like another error QUEST 2 specific : app freeze I’m trying to find any help or info to work around that issue.

I have this problem in 2020.3.2. I have a healthy amount of memory overhead, and the individual scenes run fine when loaded into directly, but doing a LoadScene or LoadSceneAsync into them from another scene causes an out of memory crash on Quest 2. Anyone in here figured anything out for this?

Did anyone test this on the latest LTS or 2021 version?

Sorry to resurrect this, I am running into the same thing, did anyone find out what causes this or how to debug it?

I recommend making a new post instead of reviving a new one.
First update unity to the latest lts, update XR plugins and update Oculus Integration if used.