I have prefabs packed separately into ~35MB Addressables bundles. I load only one at the time and replace the formerly loaded with new one.
Before loading them I check for handle .Status and release it with Addressables.Release.
Then I load them in WebGL platform using Addressables.LoadAssetAsync and after that is done (Corutine yield return handle) I do Addressables.InstantiateAsync
With every new prefab that I load this way memory goes up until the page breaks running out of memory.
I tried to skip loading and go strait to Addressables.InstantiateAsync but it has the same result.
I tried to do Addressables.ReleaseInstance instead but, agian, the same.
I looked at Unity Profiler memory by running this from Unity Editor and the Graphics&Graphics driver memory (Mesh memory) keeps rising also
As I understood Addressables documentation Addresabbles.Release should clear the memory.
Do I do something wrong here?
My understanding is that Addressables.Release() should indeed release the memory, as long as there are no other references to the memory either. If that does not happen, and you are positive that you don’t have any memory references in place, then I recommend filing that as a bug against the Addressables package.
How do you mean that there is no other reference to the memory?
All prefabs are single prefabs with no dependency (do not have a material or anything) packed separately so it is only one bundle per one prefab, no dependency.
I use the same AsyncOperationHandle for when I load and unload one by one, on demand.
The prefabs has a script on them that I use to store additional data about the prefab.
I do have a reference to that script though.
Have you taken a memory snapshot with the Memory Profiler (ideally version 1.1.0-exp.1) and checked that there are indeed no longer any references to the assets that you think should be unloaded?
Or used the Addressables profiling tools (which ones depend on your Unity and Addressables package version, so check the Addressables manual page related to your specific setup)?
Sry for late reply but I don’t really have the time to try everything
I “solved” this problem by using Resources.UnloadUnusedAssets right after Releasing addressable.
I am not sure about the editor part in rising memory usage also. Maybe I misread it, but, unfortunately I don’t have a time to test that now.
There is other issue at hand now that I need to solve:
Unity WebGL on Angular site is using 2-4GB of memory and I have no means of bringing it down.
In the memory snapshot, all meshes, images and code are less than 500MB but browser is just way more needy.
I researched that a bit and everything comes down to the project itself but there is no way I can get that under 500MB.
Anyone have any idea if total browser memory usage can be lowered somehow?