public VirtualMemoryPtr(int memorySize) : base(IntPtr.Zero, ownsHandle: true) { ProcessHandle = VirtualMemoryManager.GetCurrentProcessHandle(); MemorySize = (IntPtr)memorySize; AllocatedPointer = VirtualMemoryManager.AllocExecutionBlock(memorySize, ProcessHandle); Disposed = false; }
protected override bool ReleaseHandle() { if (!Disposed) { Disposed = true; GC.SuppressFinalize(this); VirtualMemoryManager.VirtualFreeEx(ProcessHandle, AllocatedPointer, MemorySize); } return(true); }