/// <summary>
 /// Releases all resources associated with this object
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     if (!isDisposed)
     {
         isDisposed = true;
         Marshal.FreeHGlobal(_memoryPointer);
         GC.RemoveMemoryPressure(_byteLength);
         _pointerManager = null;
     }
 }
        public UnmanagedMemoryManager(int length)
        {
            if (length <= 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            _length         = length;
            _byteLength     = SizeOf(typeof(T)) * length;
            _memoryPointer  = Marshal.AllocHGlobal(_byteLength);
            _pointerManager = new UnmanagedPointerMemoryManager <T>((T *)_memoryPointer.ToPointer(), length);
            GC.AddMemoryPressure(_byteLength);
        }