Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Memory leak with WWW on iOS

$
0
0
Hello, I have an image sensor hooked to a local server that takes roughly 10 images per second. With my Unity iOS app, I'm trying to display that camera feed. It works well when I run the Unity app on my computer but on the iOS app, although the image is displayed and updated, the memory goes high very fast until it stops my app. When I analyse the app memory allocation with Instruments "GFX Texture Level" and "Malloc 228.0 KB" are getting high very fast. I saw that other users had similar issue with the WWW class on iOS not releasing correctly objects... I wanted to know if that still the case with the current Unity version (5.3.2)? If yes how could I fix this? Here is my code: void Update () { StartCoroutine (DownloadImage ()); } IEnumerator DownloadImage(){ WWW www = new WWW("http://192.168.2.188/tele/image.jpg"); yield return www; if (string.IsNullOrEmpty(www.error)) { Texture2D texture = new Texture2D (www.texture.width, www.texture.height, TextureFormat.PVRTC_RGB2, false); www.LoadImageIntoTexture (texture as Texture2D); GetComponent ().sprite = Sprite.Create (texture, new Rect (0, 0, www.texture.width, www.texture.height), Vector2.zero); texture = null; } www.Dispose (); www = null; }

Viewing all articles
Browse latest Browse all 4709

Trending Articles