WWW has memory leak on Unity 4.6.2 Android

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 OnCompletedFile, Action _OnProgressFile)
{
isErrorDone = false;
using (www = new WWW(url))
{
OnProgressFile = _OnProgressFile;
//__DebugOutput("DownloadFileRoutine : " + www.progress);:wink:

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

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


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…

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…

update: playing on mini retina ipad, where memory is stable ~ 240Mb , but got crash: “Message from debugger: Terminated due to memory Error”

I also report an issue to unity: http://fogbugz.unity3d.com/default.asp?671469_ehji4m99k0nscps6

@Chung87 : could you pls file a bug report on it with small repro project and tell case # here. Thank you in advance.

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.