I'm getting warned of a memory leak, but when I enable stack trace for memory leak detection it stops warning me. Is there a leak here? The warning is about pointsArray, so I've only included code about said NativeArray, although I will say keyPoints uses Allocator.Temp and NativeArrayOptions.UninitializedMemory. This is in a static method with the BurstCompile attribute.
NativeArray<NativeSlice<int2>> pointsArray = new(phase + 2, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
int j = 0;
for (int i = 0; i < keyPoints.Length; i += 2, j++)
{
pointsArray[j] = new NativeSlice<int2>(keyPoints, i, 2);
}
string debugString = $"pointsArray:";
for (int i = 0; i < pointsArray.Length; i++)
{
debugString += $"\npointsArray[{i}]:";
foreach (int2 p in pointsArray[i])
{
debugString += $" {p}";
}
}
keyPoints.Dispose();
pointsArray.Dispose();