Search Issue Tracker

Fixed in Unity 5.4.2

Votes

13

Found in

5.3.6f1

Issue ID

819470

Regression

Yes

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

UI

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 2No workaround

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)

Note:
- 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. A9e111d1a0fa24ccaf1bcedd1c80e857?d=mm

    tepo01

    May 09, 2017 15:47

    Reproduced in 5.6.0f3

    Please fix, thanks!

  2. B76cb803d90fd15eec3249a488c8174c?d=mm

    whiskers434

    Dec 20, 2016 03:33

    Reproduced in 5.4.1f1, 5.50f3

    plz fix thanks

  3. 791c3824aa0b2c240b3e20b0c7bdaad3?d=mm

    Ethan_VisualVocal

    Sep 15, 2016 20:24

    Fix now out in Patch 5.3.6p5 and Patch 5.4.1p1

  4. 82d7ad421f328c7ee1dba0e25e63e744?d=mm

    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. 0463cfb596d99d5029f9f4287e7f0842?d=mm

    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: http://forum.unity3d.com/threads/cant-view-canvas-in-daydream-vr.421401/

    "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."

    https://github.com/googlevr/gvr-unity-sdk/issues/283#issuecomment-243413766

  6. 24c584983889bee9c6188bfea4010cb0?d=mm

    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. 865a711e95c6d7f0bbad0e8dfd0d7f3d?d=mm

    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. 791c3824aa0b2c240b3e20b0c7bdaad3?d=mm

    Ethan_VisualVocal

    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. 791c3824aa0b2c240b3e20b0c7bdaad3?d=mm

    Ethan_VisualVocal

    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:

    https://github.com/googlevr/gvr-unity-sdk/issues/283#issuecomment-241115145

  10. 791c3824aa0b2c240b3e20b0c7bdaad3?d=mm

    Ethan_VisualVocal

    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]

All about bugs

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