Binarysharp.MemoryManagement.Memory.MemoryFactory.Allocate C# (CSharp) Method

Allocate() public method

Allocates a region of memory within the virtual address space of the remote process.
public Allocate ( int size, MemoryProtectionFlags protection = MemoryProtectionFlags.ExecuteReadWrite, bool mustBeDisposed = true ) : RemoteAllocation
size int The size of the memory to allocate.
protection MemoryProtectionFlags The protection of the memory to allocate.
mustBeDisposed bool The allocated memory will be released when the finalizer collects the object.
return RemoteAllocation
        public RemoteAllocation Allocate(int size, MemoryProtectionFlags protection = MemoryProtectionFlags.ExecuteReadWrite, bool mustBeDisposed = true)
        {
            // Allocate a memory space
            var memory = new RemoteAllocation(MemorySharp, size, protection, mustBeDisposed);
            // Add the memory in the list
            InternalRemoteAllocations.Add(memory);
            return memory;
        }