Hey,
I’ve recently been trying to reduce overall memory usage in our game and I’ve found that remapper takes an incredibly high memory usage of about 1.79GBs.
Are there any suggestions as to what could have caused that? I find it hard to believe that a remapper would take this kind of memory usage for about 31GBs of addressable bundles, with a total of about 39000 assets spread across 259 bundles.
I’m kind of running out of ideas here so will gladly take any kind of suggestions as to what could be the cause and how to track and minimize it
Hi,
That doesn’t make a lot of sense to me either. From what I understand the remapper handles mapping serialized files to instances. Are you instantiating a large number of objects?
This kind of usage happens immediately in main menu of the game. We’ve got a total of 2101 objects (total, including all children) in all of the scenes at that point, most of it being UI (2054 objects in our canvas). However, I’ve decreased the amount of objects by 800 and it seems that the memory usage is basically the same. (1.75GB vs 1.79GB)
Hmm… well that sounds like it should be pretty easy to replicate. What version of Unity are you using and what version of Addressables? How many Asset Bundles are loaded at the point where you’re profiling?
In order not to waste your precious time I’ve done some more testing myself. I’ve used the AssetBundle.UnloadAllAssetBundles (with unloadAllObjects set to true), Resources.UnloadUnusedResources() as well as GC.Collect() to ensure that nothing unnecessary is loaded while in the main menu. Remapper’s memory usage was still 1.75GB. I’ve also tried removing basically all of our UI, leaving only about 200 objects spawned - still 1.75GB taken up by remapper, despite AssetBundle.GetAllLoadedAssetBundles showing no bundles at all.
We’re using Unity 2021.3.30f1 with addressables version 1.21.14. I’m also using a separate project in Unity 2023.2.20f1 to get the latest version of memory profiler (since the one available in Unity 2021 has some issues with tracking memory). I’ll also DM you our implementation of the addressables - perhaps there is some obvious issue that we’ve missed.
We are also seeing this behavior in our project, the moment we load our first addressable asset Remapper hits 136MB of allocated memory. We’ve tried reorganizing addressable groups and adjusting settings but the hit still occurs. I even tried putting all the assets together in one “PackTogether” group to no effect.
The only thing that did have an effect was to place a test asset inside it’s own group with no dependencies at all on any other group. Loading this asset in resulted in a much smaller remapper memory allocation.
What would be really helpful is some detailed in depth information on what the Remapper actually does.
From my test it looks like its used to manage dependencies between files found in an assetbundle?
Am I right in thinking if we have a large amount of files in asset bundles then this is just the memory it’s going to take?
1 Like
How are your groups organized? Are you using Addressable folders?
Yes we do have some addressable folders. Would referencing the individual files rather than folders improve the remapper overhead?
We think it should. From what I understand Folders are fairly blunt and everything in them gets listed in the catalog/remapper. Just focusing on the elements that you are loading through AssetReferences and letting everything else get bundled implicitly should lead to lower remapper memory usage.