internal MemoryPoolBlock(SlabMemoryPool pool, int length) { Pool = pool; var pinnedArray = GC.AllocateUninitializedArray <byte>(length, pinned: true); Memory = MemoryMarshal.CreateFromPinnedArray(pinnedArray, 0, pinnedArray.Length); }
/// <summary> /// This object cannot be instantiated outside of the static Create method /// </summary> internal MemoryPoolBlock(SlabMemoryPool pool, MemoryPoolSlab slab, int offset, int length) { _offset = offset; _length = length; Pool = pool; Slab = slab; }
internal static MemoryPoolBlock Create( int offset, int length, SlabMemoryPool pool, MemoryPoolSlab slab) { return(new MemoryPoolBlock(pool, slab, offset, length)); }
/// <summary> /// This object cannot be instantiated outside of the static Create method /// </summary> internal MemoryPoolBlock(SlabMemoryPool pool, MemoryPoolSlab slab, int offset, int length) { _offset = offset; _length = length; Pool = pool; Slab = slab; Memory = MemoryMarshal.CreateFromPinnedArray(slab.Array, _offset, _length); }