13-01-2022, 01:24 PM
Hi there
Sorry for the necropost, but I thought it made more sense than a new one since it's related to this issue.
In Obi Cloth v6.0.1 I'm also seeing a large leak with the Particle Collision constraint enabled. My test setup is as follows:
-Use the "Wind" Obi Cloth sample scene
-Remove Solver 2 and Fan
-Add an object with the following script to log memory use (quicker for this and the mem profiler)
My package versions are as follows:
-Burst 1.3.0-preview.12
-Collections 0.9.0-preview.6
-Mathematics 1.1.0
I have run the test you described in the unity forum thread, reproduced the massive leak in collections in a pre-0.2.0 version of that package (wow!) and confirmed it does not exist in 0.9.0. There does still seem to be a much smaller leak, but nowhere near that.
Now with the above setup, built to an executable to ensure no editor shenanigans, my output after a minute is as follows:
"Mem in use: 221,4MB. Time since baseline: 1:0. Mem delta since baseline: 150,3MB"
The leak continues at this pace as long as I leave the app running.
If I disable just the Particle Collision constraint on Solver 1, there is no leak.
Sorry for the necropost, but I thought it made more sense than a new one since it's related to this issue.
In Obi Cloth v6.0.1 I'm also seeing a large leak with the Particle Collision constraint enabled. My test setup is as follows:
-Use the "Wind" Obi Cloth sample scene
-Remove Solver 2 and Fan
-Add an object with the following script to log memory use (quicker for this and the mem profiler)
Code:
using UnityEngine;
using UnityEngine.Profiling;
public class MemoryLogger : MonoBehaviour
{
const float MemMultiplier = 1.0f / (1024 * 1024);
[SerializeField]
private float baselineDelaySecs = 10.0f;
[SerializeField]
private float updatePeriodSecs = 1.0f;
private float timer;
private float baselineTimer;
private float baselineTimeSinceStart;
private long baselineAllocatedMem;
void OnEnable()
{
baselineTimer = baselineDelaySecs;
timer = updatePeriodSecs;
}
// Update is called once per frame
void Update()
{
if (baselineTimer > 0.0f)
{
if ((baselineTimer -= Time.deltaTime) < 0.0f)
{
baselineTimeSinceStart = Time.realtimeSinceStartup;
baselineAllocatedMem = Profiler.GetTotalAllocatedMemoryLong();
string message = $"Baseline mem in use: {baselineAllocatedMem * MemMultiplier:f1}MB.";
Debug.Log(message);
}
return;
}
if ((timer -= Time.deltaTime) < 0.0f)
{
long memAllocated = Profiler.GetTotalAllocatedMemoryLong();
int timeSinceBaseline = (int)(Time.realtimeSinceStartup - baselineTimeSinceStart);
float memDeltaSinceBaseline = memAllocated - baselineAllocatedMem;
string message = $"Mem in use: {memAllocated * MemMultiplier:f1}MB. " +
$"Time since baseline: {timeSinceBaseline/60}:{timeSinceBaseline%60}. " +
$"Mem delta since baseline: {memDeltaSinceBaseline * MemMultiplier:f1}MB";
Debug.Log(message);
timer = updatePeriodSecs;
}
}
}
My package versions are as follows:
-Burst 1.3.0-preview.12
-Collections 0.9.0-preview.6
-Mathematics 1.1.0
I have run the test you described in the unity forum thread, reproduced the massive leak in collections in a pre-0.2.0 version of that package (wow!) and confirmed it does not exist in 0.9.0. There does still seem to be a much smaller leak, but nowhere near that.
Now with the above setup, built to an executable to ensure no editor shenanigans, my output after a minute is as follows:
"Mem in use: 221,4MB. Time since baseline: 1:0. Mem delta since baseline: 150,3MB"
The leak continues at this pace as long as I leave the app running.
If I disable just the Particle Collision constraint on Solver 1, there is no leak.