I was getting rarely a Memory Leak Warning. I fixed it with this change to DrawingData. Since Unsafe collections are wrap raw unmanaged memory. Here’s the standard safe pattern:
C#
public void Dispose ()
{
if (splitterOutput.IsCreated)
{
splitterOutput.Dispose();
}
if (vertices.IsCreated)
{
vertices.Dispose();
}
if (triangles.IsCreated)
{
triangles.Dispose();
}
if (solidVertices.IsCreated)
{
solidVertices.Dispose();
}
if (solidTriangles.IsCreated)
{
solidTriangles.Dispose();
}
if (textVertices.IsCreated)
{
textVertices.Dispose();
}
if (textTriangles.IsCreated)
{
textTriangles.Dispose();
}
if (capturedState.IsCreated)
{
capturedState.Dispose();
}
}