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. Dismiss Notice

WWW has memory leak on Unity 4.6.2 Android

Discussion in 'Android' started by Chung87, Feb 5, 2015.

  1. Chung87

    Chung87

    Joined:
    Feb 3, 2015
    Posts:
    2
    I am making patch system using WWW on Unity 4.6.2 Android

    When I play my app on device and test by the momory profiler, there are some strange memory leak.

    After patch is finishd, Used Mono Memory still remain on profiler.

    So, I test on Unity 4.5.2, there are no memory leak.

    I attach two images. one is tested by Unity 4.5.2, and another one is tested by Unity 4.6.2

    And It is my source how to using WWW Class.

    public IEnumerator DownloadFileRoutine(string url, string fileName, Action<ERRORLEVEL> OnCompletedFile, Action _OnProgressFile)
    {
    isErrorDone = false;
    using (www = new WWW(url))
    {
    OnProgressFile = _OnProgressFile;
    //__DebugOutput("DownloadFileRoutine : " + www.progress);

    yield return www;
    UnityEngine.Debug.Log("Final DownloadFileRoutine");

    if (!string.IsNullOrEmpty(www.error))
    {
    UnityEngine.Debug.LogError(www.error);
    OnCompletedFile.Invoke(ERRORLEVEL.ERR_NEEDRETRY);
    isErrorDone = true;
    yield break;
    }
    else
    {
    bool bSave = SaveFile(fileName, www.bytes);
    yield return true;
    if (bSave)
    {
    if (OnCompletedFile != null)
    {
    OnCompletedFile.Invoke(ERRORLEVEL.SUCCESS);
    }
    }
    else
    {
    OnCompletedFile.Invoke(ERRORLEVEL.ERR_ETCERROR);
    }
    }
    }
    yield return true;
    }
     

    Attached Files:

  2. et_cloudcade

    et_cloudcade

    Joined:
    Jul 8, 2014
    Posts:
    8
    same here, we also upgrade to 4.6.2f1 from 4.6.0f3 and we use a lot : WWW.LoadFromCacheOrDownload.

    on ipad3, memory just grow up as we play and crash OOM ( ~550Mb ), on a mini retina ipad there no leak, mem is stable ( ~240Mb )

    I will continue to investigate..
     
  3. Chung87

    Chung87

    Joined:
    Feb 3, 2015
    Posts:
    2
    Thankyou for reply... I think there is a bug on WWW class.

    When I change API Level option to ".Net 2.0 subset", Memory leak doesn't appear anymore on Samsung Note 2.

    If you get some information, please Let me know...
     
  4. et_cloudcade

    et_cloudcade

    Joined:
    Jul 8, 2014
    Posts:
    8
    update: playing on mini retina ipad, where memory is stable ~ 240Mb , but got crash: "Message from debugger: Terminated due to memory Error"
     
  5. et_cloudcade

    et_cloudcade

    Joined:
    Jul 8, 2014
    Posts:
    8
  6. Ruslan-Grigoryev

    Ruslan-Grigoryev

    Unity Technologies

    Joined:
    Jul 29, 2011
    Posts:
    3
    @Chung87: could you pls file a bug report on it with small repro project and tell case # here. Thank you in advance.
     
  7. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,165
    Please also include into the bug report how you make a conclusion there is a leak, then we'll take a look at this ASAP. Without a repro project your report will unlikely pass the initial filter.