I have a ton of things showing up in the snapshot such as shaders that are not assigned to any material in the entire project.
Speedtree8 takes up 24.7mb of memory and is biggest thing in the shaders part of snapshot, yet it says ref count is 0 and its not anywhere in the project.
So what exactly does this mean and why is it taking up memory?
And no there are no references to that shader in scripts either
Ive marked this as a bug as it seems erroneous. Many other entries are like this, makes tracking down problems difficult as lots of things in the snapshot seem to not actually exist
Did you profile in the editor? Because I recall another thread where someone else has the same issue and he/she was basically profiling in the editor, but in a build all these things were correct/stripped.
Also speedtree8 showed up as it was in my “Always Include” shaders list! Taking it out freed up a valuable 24.7mb and we dont use speetree anywhere so its free memory. Just in case anyone else is puzzled by the shaders part of the snapshot and why some things are there, check that list first!
I have ScriptableObjects referenced by scene that stick around between scene loads while having 0 ref count, as seen here: https://discussions.unity.com/t/768353
They are making a ton of assets linger around in memory, and I have no clue how I’m supposed to get rid of them. (UnloadUnusedAssets does nothing for them)
How do you know if an asset is “flagged” with DontDestroyOnLoad? Does that propagate through a hierarchy of objects? If so, how do you revert that?
Right now, the ScriptableObjects - and their references - sticking around between scene loads is a critical issue for us.
I don’t know where it’s displayed in Unity’s Memory Profiler, but the information is stored in the memory snapshot itself.
In Heap Explorer (see my signature), every object that will not get unloaded automatically, is displaying a warning icon. If you select that object, it displays why in the property inspector.
Screenshot
This information is most likely also displayed in Unity’s Memory Profiler somewhere.
EDIT: I forgot to mention that you can also filter for “don’t destroy on load” objects in Heap Explorer:
Screenshot
I guess Unity’s Memory Profiler supports filtering these things too.