Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NativeHeapMemoryBlock.cs
Go to the documentation of this file.
3
5
7{
9 {
11
12 public unsafe byte* Pointer => (byte*)(void*)_pointer;
13
14 public DisposableData(int size)
15 {
17 }
18
19 protected override void Release()
20 {
22 if (intPtr != IntPtr.Zero)
23 {
24 Marshal.FreeHGlobal(intPtr);
25 }
26 }
27 }
28
29 private readonly DisposableData _data;
30
31 private readonly int _size;
32
33 public unsafe override byte* Pointer => _data.Pointer;
34
35 public override int Size => _size;
36
37 internal NativeHeapMemoryBlock(int size)
38 {
39 _data = new DisposableData(size);
40 _size = size;
41 }
42
43 public override void Dispose()
44 {
45 _data.Dispose();
46 }
47}
static void FreeHGlobal(IntPtr hglobal)
Definition Marshal.cs:1680
static IntPtr AllocHGlobal(int cb)
Definition Marshal.cs:625
static int Exchange(ref int location1, int value)
static readonly IntPtr Zero
Definition IntPtr.cs:18