void DoDispose() { if (!IsDisposed) { #if DEBUG Backtraces.Remove(_backtrace); #endif _plat.Free(Address, Size); GC.RemoveMemoryPressure(Size); IsDisposed = true; Address = IntPtr.Zero; Size = 0; } }
void DoDispose() { lock (_lock) { if (!IsDisposed) { #if DEBUG lock (_btlock) Backtraces.Remove(_backtrace); #endif _plat?.Free(_address, Size); GC.RemoveMemoryPressure(Size); IsDisposed = true; _address = IntPtr.Zero; Size = 0; } } }