public static int TryFreeAll() { int c = Allocations.Count; foreach (IntPtr p in Allocations) { Jem.Free(p); } Allocations = new ConcurrentBag <IntPtr>(); return(c); }
public void Release() { if (IsInvalid) { return; } else if (Interlocked.Exchange(ref _Ptr, IntPtr.Zero) != IntPtr.Zero) { Jem.Free(_Ptr); } }
public static int TryFreeAll() { allocLock.EnterWriteLock(); int c = _Allocations.Count; foreach (IntPtr p in _Allocations.Keys) { Jem.Free(p); _Allocations.Remove(p); } allocLock.ExitWriteLock(); return(c); }
public static bool FreeFixedBuffer(IntPtr ptr) { fixedBufferLock.EnterWriteLock(); bool r = _FixedBufferAllocations.Remove(ptr); fixedBufferLock.ExitWriteLock(); if (!r) { return(false); } else { Jem.Free(ptr); return(true); } }
protected override bool ReleaseHandle() { bool r = Jem.Free(handle); if (!r) { return(false); } else { handle = IntPtr.Zero; unsafe { voidPtr = (void *)0; } Length = 0; SizeInBytes = 0; return(true); } }
protected override bool ReleaseHandle() { return(Jem.Free(handle)); }