Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MemoryManager.cs
Go to the documentation of this file.
2
3namespace System.Buffers;
4
5public abstract class MemoryManager<T> : IMemoryOwner<T>, IDisposable, IPinnable
6{
7 public virtual Memory<T> Memory => new Memory<T>(this, GetSpan().Length);
8
9 public abstract Span<T> GetSpan();
10
11 public abstract MemoryHandle Pin(int elementIndex = 0);
12
13 public abstract void Unpin();
14
15 [MethodImpl(MethodImplOptions.AggressiveInlining)]
17 {
18 return new Memory<T>(this, length);
19 }
20
21 [MethodImpl(MethodImplOptions.AggressiveInlining)]
22 protected Memory<T> CreateMemory(int start, int length)
23 {
24 return new Memory<T>(this, start, length);
25 }
26
27 protected internal virtual bool TryGetArray(out ArraySegment<T> segment)
28 {
29 segment = default(ArraySegment<T>);
30 return false;
31 }
32
34 {
35 Dispose(disposing: true);
36 GC.SuppressFinalize(this);
37 }
38
39 protected abstract void Dispose(bool disposing);
40}
Memory< T > CreateMemory(int start, int length)
void IDisposable. Dispose()
void Dispose(bool disposing)
Memory< T > CreateMemory(int length)
virtual bool TryGetArray(out ArraySegment< T > segment)
MemoryHandle Pin(int elementIndex=0)
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8