示例#1
0
        public static int TryFreeAll()
        {
            int c = Allocations.Count;

            foreach (IntPtr p in Allocations)
            {
                Jem.Free(p);
            }
            Allocations = new ConcurrentBag <IntPtr>();
            return(c);
        }
示例#2
0
 public void Release()
 {
     if (IsInvalid)
     {
         return;
     }
     else if (Interlocked.Exchange(ref _Ptr, IntPtr.Zero) != IntPtr.Zero)
     {
         Jem.Free(_Ptr);
     }
 }
示例#3
0
        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);
        }
示例#4
0
        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);
            }
        }
示例#5
0
        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);
            }
        }
示例#6
0
 protected override bool ReleaseHandle()
 {
     return(Jem.Free(handle));
 }