Hi.
I am looking for the reason why the game will eventually stop if I leave it for a long time.
I am using Unity 2020.3.20.
I checked with the Memory Profiler.
The memory of “Other” seems to be increasing.
Is there any way to check the contents of this?
What could be the cause of this continuous increase?
“Other” is technically just “Other Native Heap Memory” i.e. every native object and allocation that isn’t GPU side graphics memory (Graphics & Graphics Driver), Profiler, or Audio memory.
You should be able to see this in the Diff All Native Objects table or in the All Native Allocations Table.
You also have a lot of empty native heap space. I can’t tell if that isn’t used for the new memory because of fragmentation or because these snapshots where taken at points in time where a higher watermark was reached In-between that pushed the Reserved amount up (e.g. a level load). The Fragmentation page may help here but the workflow to analyze and tackle fragmentation is rudimentary at best at this point in the tools development. Still, in diff view it may show in which address range the growths happened and when that is selected, you can switch the bottom table there to show you the allocations or objects that were placed there.
Thank you for your support.
I left the game running for about 8 hours and used Memory Profiler to get the diffs.
There is no scene switching or file loading during this time.
I checked the Diff All Native Objects table and the Diff All Native Allocations table, and I could not find any significant memory increase.
However, the memory in (in use) has increased.
I assume this means that it is being used for something.
Is it possible that fragmentation also increases (in use)?
huh… interesting…
So there is no significant enough changes in the Native Allocations.
With the current table implementation, the Diff for All Native Objects identifies Objects as the same as long as they have the same Address, Type and NativeInstance ID. It lists no changes to these for you but I fear that there may be a change within the Native Size, which is calculated in each UnityEngine.Object type’s GetRuntimeMemorySizeLong. It should usually align with the Native Allocations rooted to the Object + any GPU side memory (which is calculated instead of tracked as allocation, as it’s external to our Memory Manager). Your Graphics & Graphics Driver Memory is constant which would indicate that the GPU side calculation results didn’t change either. So I’m a bit stumped but maaaybe something else might be reporting growing Memory Usage that is allocated outside of our Memory Manager Allocation tracking system and somehow calculated?
One way for you to check that on your side would be to copy the Memory Profiler Package’s source Code into your Project’s Packages folder and modify com.unity.memoryprofiler\Editor\Profiler\ObjectListTable.cs line 918, i.e. this one:
var metaColNativeSize = new MetaColumn("NativeSize", "Native Size", new MetaType(typeof(long), DataMatchMethod.AsNumber), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.sumpositive, typeof(long)), "size", 75);
To pass in true as the 4th parameter. Then any changes in Native Size would cause Objects to be seen being different between the snapshots.
Which Objects Types that would list as different would be interesting. If this doesn’t explain it enough, we’d need to dig even deeper, and if it does, we need to take a long hard look at these types to see what is not being tracked correctly there.
The issue of the Diff Table itself not necessarily showing memory changes within objects that persist within the same address but have varying sizes is a known issue we sadly need to address in a way more complex way than the one false->true change I outlined above as that would falsely claim the object to be deleted and recreated if the size changes, which is inaccurate…
Hi.
Our project was freezing after about 3 days,
but we were able to identify the cause.
First we updated to Unity 2020.3.24.
I think it is probably this bug (1362505).
When I updated, Other Memory increased less.
T
here was another problem in our project.
This is the part where SetActive(true) and SetActive(false) of the collider are done every frame.
For some reason, the memory allocated by SetActive(true) was not being released, so we removed this part.
I was able to solve the problem.
Thank you very much for your support.