Search Unity

How to stop graphics memory usage from growing?

Discussion in 'VR' started by visionnaireMedia, May 5, 2020.

Thread Status:
Not open for further replies.
  1. visionnaireMedia

    visionnaireMedia

    Joined:
    Jul 25, 2016
    Posts:
    17
    Hello everyone, I've been on this project for quite a long time and just now that I updated the whole thing to a new version of unity (2019.3.7 or even 2019.3.11) the app is starting to crash very badly on android devices.

    What I'm using is:
    • socket.io for unity
    • easy movie texture
    • pico sdk (for virtual reality, i'm building on pico devices)
    • mediaplayer 8 (this is new, but the problem is there even without this one)
    So what happens is that in the beginning you're in a room and you have to type your name, pick a presentation and connect to the internet through the socket.

    Problem is that even without doing anything at all, the app crashes after 2m 21s, and we found out after a long time that the issue is caused by the "GfxDriver" memory usage as it keeps growing until the system kills the app for using too much memory (starts at 45MB and ends up to about 145MB before crashing, anything else is stable on it's initial values).

    As the game starts I only have a sphere with a texture, the camera inside it and 2 canvas, no animations, no weird effects, no post-render or pre-render.

    The errors I get during the crash vary, here are some I got:
    [EGL] Unable to acquire context: EGL_BAD_SURFACE: An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.

    [EGL] eglDestroySurface(m_EGLDisplay, m_EGLSurface): EGL_BAD_SURFACE: An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.

    [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).

    OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
     
    Last edited: May 5, 2020
  2. visionnaireMedia

    visionnaireMedia

    Joined:
    Jul 25, 2016
    Posts:
    17
    It looks like the issue was caused by the PicoSDK plugin as Unity was too updated for it. :/
     
  3. warpbu

    warpbu

    Joined:
    Jan 29, 2017
    Posts:
    8
    Hi @visionnaireMedia

    We are in a similar situation. What version of Unity did you end up using for your Pico project and did it solve all your GL issues?

    Cheers,
    Patrik
     
  4. RupeOxVR

    RupeOxVR

    Joined:
    Jul 18, 2018
    Posts:
    7
    We had this this issue when we first tried porting our Quest project to the Pico Neo 2.

    The original project was using Unity 2019.3.8. The Pico SDK documentation said that they supported Unity up to 2019.3.6, so we thought "that's only a couple of patch numbers let's try to do it without downgrading". Everything worked fine except when run on the device it crashed out after 20s or so with gfx memory issues.

    What we were seeing in the logcat was a lot of this

    W Adreno-GSL: <sharedmem_gpuobj_alloc:2668>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
    E Adreno-GSL: <gsl_memory_alloc_pure:2270>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed


    Followed by

    OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state
    05-21 16:57:17.490 15275 15420 E Unity : (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 353)


    We asked Pico support about it and they confirmed that this is a known issue and is why they don't support higher than 2019.3.6 (in their current SDK which is version 2.8.6).

    "The reason we do not support Unity 2019.4 is that there is a known issue on 2019.4 or higher versions where the GfxDriver will keep allocating memory without collect them, so the app will crash once out of memory. Unfortunately, since Unity have confirmed that this is an issue on their side, we can only wait for them to fix it."

    Note that while they refer to not supporting 2019.4, our experience is actually that 2019.3.6 is (as stated in their SDK docs and download page) actually the highest supported version. Later patches of 2019.3 (such as those mentioned by the OP above) will not work.

    The latest update from Pico is that Unity have told them that the issue has been evaluated as requiring 30 man hours to fix. It's not clear to us yet whether or not this work is underway.

    So in summary, from our experience, we would recommend going no higher than Unity 2019.3.6 if you want to deploy to the Pico Neo 2.
     
    Last edited: Sep 2, 2020
    visionnaireMedia likes this.
  5. visionnaireMedia

    visionnaireMedia

    Joined:
    Jul 25, 2016
    Posts:
    17
    Yeah, we realized the same and we're now using Unity2019.2 as it supports custom AndroidManifests, while newer versions will mess it up
     
  6. Sam-person

    Sam-person

    Joined:
    Oct 29, 2019
    Posts:
    11
    @RupeOxVR What specific version are you running at now? I hit that issue in 2019.3.0f3, which is below their 'max'. Gonna try and hit tit on exactly x.3.6 but I'm curious if you can get below that or if there's just too many holes?

    It's also an issue which only began surfacing once I instantiated the Pico SDK object, instead of having it in the scene on start (which I'm using to support multiple VR SDKs). No idea if that was just a coincidence.
     
    NAKAS likes this.
  7. liekong1991

    liekong1991

    Joined:
    Nov 15, 2014
    Posts:
    12
    The SDK Document site said it support from Unity2017.4~Unity 2019.3.6, and Unity2019.4.1x、Unity2020.1.8
     
    NAKAS likes this.
  8. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey there!

    The PicoVR Unity SDK is developed and supported by Pico directly. Please send issues to their support channel and they will help address. Contact information can be found here.

    Will lock the post now!
     
Thread Status:
Not open for further replies.