public void Init() { m_FreeBits = ~0ul; int allocSize = sizeof(StateAllocLevel1) * 64; var l1 = m_Level1 = (StateAllocLevel1 *)Memory.Unmanaged.Allocate(allocSize, 16, Allocator.Persistent); UnsafeUtility.MemClear(l1, allocSize); for (int i = 0; i < 64; ++i) { l1[i].FreeBits = ~0ul; } }
public void Dispose() { var l1 = m_Level1; for (int i = 0; i < 64; ++i) { if (l1[i].States != null) { Memory.Unmanaged.Free(l1[i].States, Allocator.Persistent); } } Memory.Unmanaged.Free(l1, Allocator.Persistent); m_Level1 = null; this = default; }
public void Dispose() { var l1 = m_Level1; for (int i = 0; i < 64; ++i) { if (l1[i].States != null) { UnsafeUtility.Free(l1[i].States, Allocator.Persistent); } } UnsafeUtility.Free(l1, Allocator.Persistent); m_Level1 = null; this = default; }