示例#1
0
        public void Free()
        {
            if (_handle.IsAllocated)
            {
                _handle.Free();
            }

            if (_owner != null)
            {
                _owner.Release();
                _owner = null;
            }
        }
示例#2
0
        /// <summary>
        /// Frees the pinned handle and releases IRetainable.
        /// </summary>
        public void Dispose()
        {
            if (_handle.IsAllocated)
            {
                _handle.Free();
            }

            if (_retainable != null)
            {
                _retainable.Release();
                _retainable = null;
            }

            _pointer = null;
        }
示例#3
0
 public MemoryHandle(IRetainable owner, void *pointer = null, System.Runtime.InteropServices.GCHandle handle = default(System.Runtime.InteropServices.GCHandle))
 {
     throw null;
 }
示例#4
0
 public BufferHandle(IRetainable owner, void *pinnedPointer, GCHandle handle = default(GCHandle))
 {
     _pointer = pinnedPointer;
     _handle  = handle;
     _owner   = owner;
 }
示例#5
0
 /// <summary>
 /// Creates a new memory handle for the memory.
 /// </summary>
 /// <param name="retainable">reference to manually managed object</param>
 /// <param name="pinnedPointer">pointer to the buffer, or null if the buffer is not pinned</param>
 /// <param name="handle">handle used to pin array buffers</param>
 public MemoryHandle(IRetainable retainable, void *pinnedPointer = null, GCHandle handle = default(GCHandle))
 {
     _retainable = retainable;
     _pointer    = pinnedPointer;
     _handle     = handle;
 }
 public void Dispose()
 {
     _owner.Release();
     _owner = null;
 }
 internal DisposableReservation(IRetainable owner)
 {
     _owner = owner;
     _owner.Retain();
 }
示例#8
0
 public BufferHandle(IRetainable owner) : this(owner, null)
 {
 }
示例#9
0
 public MemoryHandle(IRetainable owner, void *pointer = null, GCHandle handle = default(GCHandle))
 {
     _owner   = owner;
     _pointer = pointer;
     _handle  = handle;
 }