Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Quest 2 - OPENGL NATIVE PLUG-IN ERROR: GL_OUT_OF_MEMORY

Discussion in 'VR' started by hungrybelome, Oct 18, 2020.

  1. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    Hi,

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

    Code (CSharp):
    1. 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:

    Code (CSharp):
    1. 10-15 18:38:30.565 10993 11075 E Unity   : Could not allocate memory: System out of memory!
    2. 10-15 18:38:30.565 10993 11075 E Unity   : Trying to allocate: 89478512B with 16 alignment. MemoryLabel: Texture
    3. 10-15 18:38:30.565 10993 11075 E Unity   : Allocation happened at: Line:78 in
    4. 10-15 18:38:30.565 10993 11075 E Unity   : Memory overview
    5. 10-15 18:38:30.565 10993 11075 E Unity   :
    6. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_THREAD ] used: 168236B | peak: 0B | reserved: 2785280B
    7. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_1_FRAME ] used: 0B | peak: 0B | reserved: 3145728B
    8. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_2_FRAMES ] used: 0B | peak: 0B | reserved: 1048576B
    9. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_4_FRAMES ] used: 0B | peak: 0B | reserved: 2097152B
    10. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_TEMP_JOB_ASYNC ] used: 43333337B | peak: 0B | reserved: 77594624B
    11. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_DEFAULT ] used: 140247130B | peak: 145943275B | reserved: 142429470B
    12. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_GAMEOBJECT ] used: 1705614B | peak: 4918456B | reserved: 1722220B
    13. 10-15 18:38:30.565 10993 11075 E Unity   : [ ALLOC_GFX ] used: 429598681B | peak: 518361205B | reserved: 429610480B
    14. 10-15 18:38:30.565 10993 11075 E Unity   :
    15. 10-15 18:38:30.565 10993 11075 E Unity   :  #0 0xc7fe0539 (libunity.so) ? 0x0
    16. 10-15 18:38:30.565 10993 11075 E Unity   :  #1 0xc86bf5a7 (libunity.so) ? 0x0
    17. 10-15 18:38:30.565 10993 11075 E Unity   :  #2 0xc8020c69 (libunity.so) ? 0x0
    18. 10-15 18:38:30.565 10993 11075 E Unity   :  #3 0xc801f24d (libunity.so) ? 0x0
    19. 10-15 18:38:30.565 10993 11075 E Unity   :  #4 0xc801f561 (libunity.so) ? 0x0
    20. 10-15 18:38:30.565 10993 11075 E Unity   :  #5 0xc801f50d (libunity.so) ? 0x0
    21. 10-15 18:38:30.565 10993 11075 E Unity   :  #6 0xc81154b5 (libunity.so) ? 0x0
    22. 10-15 18:38:30.565 10993 11075 E Unity   :  #7 0xc7e22eb9 (libunity.
    23. 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
    24. 10-15 18:38:31.255 10993 11046 E Unity   : (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 354)
    25. 10-15 18:38:31.255 10993 11046 E Unity   :
    This is then spammed in the logcat after the error:
    Code (CSharp):
    1. 10-18 20:04:42.830 18979 19024 E Adreno-GSL: <gsl_memory_alloc_pure:2585>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
    2. 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:

    Code (CSharp):
    1. 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?
     
    Last edited: Oct 24, 2020
    Gruguir and DanjelRicci like this.
  2. carcasanchez

    carcasanchez

    Joined:
    Jul 15, 2018
    Posts:
    177
    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.
     
  3. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
  4. AndreInfante

    AndreInfante

    Joined:
    Oct 26, 2013
    Posts:
    5
    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?
     
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    2,054
    Did anyone test this on the latest LTS or 2021 version?
     
  6. kibbles-n-crits

    kibbles-n-crits

    Joined:
    Apr 22, 2016
    Posts:
    58
    Sorry to resurrect this, I am running into the same thing, did anyone find out what causes this or how to debug it?
     
  7. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    2,054
    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.