public T[][] Allocate(int size) { var ret = new T[][] { new T[size] }; _events?.Allocate(size); return(ret); }
public bool TryPush(T buffer) { if (_buffers.Count >= _maxCount) { return(false); } _buffers.Push(buffer); _events?.Allocate(_bufferSize); return(true); }
public BufferPtr Allocate(int size) { if (size <= 0) { return(BufferPtr.Zero); } var ret = Marshal.AllocHGlobal(size); _buffers.TryAdd(ret, size); _events?.Allocate(size); if (_clear) { UnmanagedAllocator.ClearBuffer(ret, size); } return(new BufferPtr(ret, size)); }
public T Add(T buffer) { _buffers.Add(buffer); _events?.Allocate(_bufferSize); return(buffer); }