public void Dispose() { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckDeallocateAndThrow(m_Safety); DisposeSentinel.Dispose(ref m_Safety, ref m_DisposeSentinel); #endif NativeHashSetData.DeallocateHashSet(buffer, allocator); buffer = null; }
public NativeHashSet(int capacity, Allocator allocator) { NativeHashSetData.AllocateHashSet <T>(capacity, allocator, out buffer); this.allocator = allocator; #if ENABLE_UNITY_COLLECTIONS_CHECKS DisposeSentinel.Create( out m_Safety, out m_DisposeSentinel, callSiteStackDepth: 8, allocator: allocator); #endif Clear(); }