Addressable texture still in memory after release

I have a large addressable texture (~1 Gbyte) that simply will not leave memory, as shown in the Memory Profiler. It is the only addressable asset in the entire game and I destroy the game object it is attached to, and then release the texture with the code below. I have changed the order of these commands and/or removed some, but nothing changes. The texture remains in memory in the scene, and persists into the next scene (only two scenes in the game - scene changes are not additive).

I used DestroyImmediate and the texture finally disappeared from memory, but that of course is not a viable option during game play.

My implementation is based on this documentation:
https://docs.unity3d.com/Packages/com.unity.addressables@1.18/manual/AddressableAssetsAsyncOperationHandle.html

//Get the texture:   
textureHandle = Addressables.LoadAssetAsync<Texture>("MyTexture");
//use texture on gameObjectWithTexture, then remove gameobject and the texture
Destroy(gameObjectWithTexture);
        Addressables.Release(textureHandle);
        Resources.UnloadUnusedAssets();
        Caching.ClearCache();

Other posts have asked this same question but no resolution seems to have been found in two years:

I am using Unity 2020.3.12f1 and the latest version of Addressables (1.16.19)

I am at a loss of how to clear this texture from memory and it is essentially breaking the game at this point. Any help would be much appreciated. Thanks!

I’ll flag with the team for some guidance!

Much appreciated!! :slight_smile:

We had an oversight were we added a callback without removing the callback once done. This has now been fixed and should be in the next release. If you need this before the release. You can edit your package locally and I can give you the details of the changes. Then let me know.

I have the same question, when will the next version be released?

I find same problem

I want to know how to fix it~
I find that use loadAsset load multi asset from same assetbundle and do release,nothing can free,
is it same for this problem

Yes, I would be grateful for the fix, thank you very much. Unless the next release is coming out within the next couple of weeks, in which case I’d just wait.

The release is expected this week, so long as testing goes well.
The fix is a small code change, In ProviderOperation.cs WaitForCompletionCallback need to be nulled in ProviderCompleted, and in InvokeWaitForCompletion after InvokeExecute it needs to be checked if null, and return false.

any updates? i’m having problem in 1.16.19. i tried releaseing both handle and gameobject but texture still remains in memory. objects are being removed from the addressable event viewer.

@rabishan-maharjan we’re up to version 1.18.15 - can you update and see if that resolves your issue?

thanks, didn’t know that. the package manager window didn’t show any updates. it all works now.