Allocation when loading textures from disk

I have a function that loads a “full size” image from disk when you touch the thumbnail, and am having trouble un-allocating the memory. I’ve tried “re-using” a global texture of the width/height of the textures I’m trying to load, but it fails to show the image when loading into it.

Something like:

Texture2D _tx;

void Start(){
_tx = new Texture2D(Screen.width, Screen.height);
}

void LoadBigImg(int num){
stringfullPath = Path.Combine (Application.persistentDataPath, fullResFileList[num]);
WWW www = new WWW(pathPreFix + fullPath);
yield return www;
_tx = www.textureNonReadable;
_selectedFullScreenImage.texture= _tx;
}

That fails to load the data into _tex, at least after the first time.

What does work, but allocates each time it’s called, is:

Texture2D _tx = new Texture2D (Screen.width, Screen.height);
        string fullPath = Path.Combine (Application.persistentDataPath, fullResFileList[value]);
        WWW www = new WWW(pathPreFix + fullPath);
        yield return www;
       
        _tx = www.textureNonReadable;

        _selectedFullScreenImage.texture= _tx;

So I started adding _tx to a List of type Texture2D, and calling Destroy() on each Texture2D in that list before loading another image from disk, but it still allocates when I destroy that.

Any idea’s on what is the proper way to create a Texture2D, load an image into it from disk, use it for a while, then load a different image and destroy the previous, while keeping the same memory footprint on iOS? Currently it just allocates more for each image until it crashes.

…since a new Texture2D is created each time the function is called and there’s no reference to it outside of that function to then destroy it, adding it to another variable and destroying that variable doesn’t affect the original. Which makes sense, how should I be doing this?

What happens if you Object.Destroy(_tx) before attempting to re-use it?