Search Issue Tracker

Fixed in 5.4.2



Found in


Issue ID




[GoogleVR] Canvas are allocating memory and do not release it when using VR cameras



Reproduction steps:
1) Create new project and import "GoogleVRForUnity" package
2) Open "DemoScene" scene (GoogleVR/DemoScenes/HeadsetDemo/DemoScene.unity)
3) Open profiler
4) Enter Playmode
-- Notice how memory is rising infinitely (not releasing)

- Toggling between two cameras and one (turning on and off VR mode) releases memory
- Deleting all canvas in scene also releases memory
- Issue reproduces on iOS and Android

Regression introduced in 5.3.4p5

Comments (10)

  1. tepo01

    May 09, 2017 15:47

    Reproduced in 5.6.0f3

    Please fix, thanks!

  2. whiskers434

    Dec 20, 2016 03:33

    Reproduced in 5.4.1f1, 5.50f3

    plz fix thanks

  3. MechEthan

    Sep 15, 2016 20:24

    Fix now out in Patch 5.3.6p5 and Patch 5.4.1p1

  4. NOT_Lonely

    Sep 13, 2016 09:56

    It's not fixed yet in 5.4.1, but 5.4.2 is not released. Very strange things.

  5. willisp

    Aug 30, 2016 13:20

    @mswf on the GoogleVR topic found a great workaround to completely stop the leak, from a post on the Unity forums:

    "This issue is fixed and will be released in patches for both 5.4 and 5.3, however if you are using the cardboard plugin you can work around the memory leak for now.

    In stereoController.cs OnPreCull comment out cam.enabled = false. The issue is that if the camera is not active at the end of the frame its resources wont be freed. This problem will be resolved in Unity going forward."

  6. wissevrowl

    Aug 29, 2016 15:57

    We are also very eagerly awaiting this fix. Is there any way to make Unity reconsider the fix's release date? This issue affects most if not all Google Cardboard developers. Waiting for 5.4.3 is not an option for Google VR developers.

  7. sapanda88

    Aug 26, 2016 13:28

    We were hoping that was a typo for 5.4.0p3... but it's not in the latest patch. Not sure why this isn't higher priority... This issue has been causing us leaks at about 2mb/s - so causing the app to crash within a minute and blocking us from submission.

  8. MechEthan

    Aug 25, 2016 20:06

    Just saw this got updated to Fixed... but, in 5.4.3? Is that a typo?

    5.4.1 isn't even out yet, so that makes availability of the fix 3+ months out?

  9. MechEthan

    Aug 22, 2016 17:58

    To be clear: this is a Unity bug, specifically when "Unity renders a world-space Canvas with any Camera targeting a RenderTexture" -- to quote @smdol, a dev on the GoogleVR Unity SDK:

  10. MechEthan

    Aug 12, 2016 17:30

    In a scene with a few dozen UI elements in canvases, this bug claims memory pretty quickly and gets the app killed by the OS. (~1MB every ~3 sec, in my case.)

    On iOS, every allocation stack trace seems to share these calls in common:

    7 UI::Canvas::DrawIntermediateRenderer(UI::Batch&, Matrix4x4f, int, Camera*, unsigned short)
    6 UI::Canvas::EmitWorldGeometry(Camera*, unsigned short&, bool)
    5 UI::CanvasManager::EmitWorldGeometry()
    4 PlayerLoop(bool, bool, IHookEvent*)
    3 UnityPlayerLoopImpl(bool)
    2 UnityRepaint
    1 -[UnityAppController(Rendering) repaintDisplayLink]

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.