iOS - Memory Issue with Dynamic Textures

Hello,

I’m having a real hard time with my app. I’ve stripped everything back apart from my core system.

I basically have an app that uses the device camera feed, the user can takes an image of that (ReadPixels). From that, the app crops the image to a square, and then rescales it to a 512 x 512 texture.

This image is then duplicated 12 times ((512 * 512) * 12) each with a pixel adjustment.

Once this is complete, the app basically goes back to the start (doesn’t restart!) - this is to test for the memory leak. I clean my memory up by doing this:

//global search for textures
    var ob = FindObjectsOfType (Texture2D);
    for (var t : Texture2D in ob){
        DestroyImmediate(t, true);
    }

This manages to successfully pull all my texture2Ds, and removes them - the memory within Xcode does decrease, but not a huge amount, and it will forever build up.

I’ve uploaded my Unity Project for you guys to have a look at, but I’ve looked around the internet, and I can’t seem to find a straight answer.

2296688–154532–MemoryIOS.zip (921 KB)

Hi,

This issue is already converted into a bug. When it will appear on issuetracker I will post link to it here.

Regards,
Rolandas
QA Team

Hello Oliver,
Thanks for posting your example project. This is indeed a bug and we are investigating it further. There are a couple of things you can do in order to reduce your memory footprint until the fix is released:

In your Manager.js file you can help clean up memory by setting certain variables to null manually. For example a large stack variable is created in the RemoveAlphaFromImage

var pixels : Color[] = i.GetPixels(0, 0, i.width, i.height, 0);

By setting that variable to null after the loop I noticed a significant drop in how fast memory was growing. You can follow this pattern with other, similar variables to further reduce this memory growth.

I hope this helps until the bug is resolved.
Thanks,
Chris

Hi,

This issue appeared on issuetracker, so now you can track progress.

Issue tracker link:

Regards,
Rolandas
QA Team