/// <summary> /// Indicates that this entire pointer's memory space has been freed, and this reference cannot be used again /// </summary> public void Free() { if (_memory != null) { _memory.Free(); _memory = null; } _elementsOffset = -1; }
public Pointer(IMemoryBlockAccess <T> memoryAccess, int absoluteOffsetElements) { _memory = memoryAccess; _elementsOffset = absoluteOffsetElements; _elementSize = PointerHelpers.GetElementSize(typeof(T)); }
public Pointer(T[] buffer, int absoluteOffsetElements) { _memory = new BasicMemoryBlockAccess <T>(new MemoryBlock <T>(buffer)); _elementsOffset = absoluteOffsetElements; _elementSize = PointerHelpers.GetElementSize(typeof(T)); }
private int _elementSize; // Size in bytes of each array element (set to 1 for non-primitive types) #endregion #region Constructors public Pointer(int capacity) { _memory = new BasicMemoryBlockAccess <T>(new MemoryBlock <T>(capacity)); _elementsOffset = 0; _elementSize = PointerHelpers.GetElementSize(typeof(T)); }