System.GC.AddMemoryPressure and System.GC.RemoveMemoryPressure should be updated when Unsafe.allocateMemory is called, Unsafe.reallocateMemory and Unsafe.freeMemory().
We do this by storing an sizeof(IntPtr) header at the beginning of the allocate block of memory, so we can record the original length to remove upon deallocation.
System.GC.AddMemoryPressure and System.GC.RemoveMemoryPressure should be updated when Unsafe.allocateMemory is called, Unsafe.reallocateMemory and Unsafe.freeMemory().
We do this by storing an sizeof(IntPtr) header at the beginning of the allocate block of memory, so we can record the original length to remove upon deallocation.