// TODO: Should this class hold a reference to the allocator, in prep for when ArrayAllocator // is no longer global state? // TODO: convert this to Dispose pattern // https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose /// <summary> /// Visits all arrays held by this object and returns them to the associated allocator. /// </summary> public void Free() { foreach (Array array in Reflect.ExtractArrays(this)) { if (array.Rank != 1) { throw new NotImplementedException("Multi-dimensional arrays are not supported"); } UsdIo.ArrayAllocator.Free(array.GetType(), (uint)array.GetLength(0), array); } }