external page Reserves, commits, or modifications the state of a area of memory within the virtual address area of a specified process (allotted memory is initialized to zero). The handle to a process. The perform allocates memory within the virtual tackle house of this course of. OPERATION entry proper. For more data, see Course of Safety and Access Rights. If Process is NULL, the function allocates memory improvement solution for the calling process. The pointer that specifies a desired starting deal with for the area of pages that you simply wish to allocate. If BaseAddress is NULL, the function determines where to allocate the region. Requirements structure must consist of all zeroes, and the base address have to be a multiple of the system allocation granularity. To determine the allocation granularity, use the GetSystemInfo operate. If this address is inside an enclave that you haven't initialized by calling InitializeEnclave, VirtualAlloc2 allocates a web page of zeros for the enclave at that handle. The web page should be previously uncommitted, and won't be measured with the EEXTEND instruction of the Intel Software Guard Extensions programming mannequin.
Address error. That is true for enclaves that do not help dynamic memory management (i.e. SGX1). SGX2 enclaves will permit allocation, and the page have to be accepted by the enclave after it has been allotted. The dimensions of the area of memory to allocate, in bytes. The scale must always be a multiple of the web page size. Dimension. This means, for example, that a 2-byte range that straddles a web page boundary causes the perform to allocate both pages. The kind of memory allocation. This parameter should include considered one of the next values. RESERVE and a non-NULL BaseAddress fails until all the range has already been reserved. An try and commit a web page that is already committed does not trigger the perform to fail. This means that you can commit pages with out first determining the current commitment state of each page. Different memory allocation capabilities, corresponding to malloc and LocalAlloc, can not use reserved Memory Wave until it has been released.
After you replace a placeholder with a private allocation, to free that allocation back to a placeholder, see the dwFreeType parameter of VirtualFree and VirtualFreeEx. A placeholder is a sort of reserved memory area. A placeholder is a sort of reserved memory region. RESET will comprise zeros. If you need the range to contain zeros, decommit the memory and then recommit it. RESET, the VirtualAlloc2 perform ignores the worth of fProtect. RESET and the vary of memory is mapped to a file. A shared view is barely acceptable whether it is mapped to a paging file. This value can't be used with any other worth. RESET earlier, the habits is undefined. RESET, the VirtualAlloc2 operate ignores the value of PageProtection. This parameter can even specify the following values as indicated. The dimensions and alignment should be a multiple of the big-web page minimal. To obtain this value, use the GetLargePageMinimum perform. A 64K web page is a region of memory that is 64K in measurement, virtually and physically contiguous, and virtually and bodily aligned on a 64K boundary.
PAGES is pageable, and bodily pages backing the memory are allotted on demand (at the time of entry). PAGES allocation may be mapped utilizing non-contiguous small pages instead. NONPAGED attribute, the allocation will be mapped utilizing non-paged 64K pages. In that case, if contiguous 64K pages cannot be obtained, the allocation will fail. PAGES is specified, the size and BaseAddress parameters should both be multiples of 64K (BaseAddress may be NULL). RESERVE and no other values. The memory protection for the region of pages to be allotted. If the pages are being committed, you possibly can specify any one of many memory safety constants. PARAMETER. Every of those extended parameter values can itself have a type area of either MemExtendedParameterAddressRequirements or MemExtendedParameterNumaNode. If no MemExtendedParameterNumaNode extended parameter is supplied, then the behavior is similar as for the VirtualAlloc/MapViewOfFile features (that's, the popular NUMA node for the bodily pages is decided based mostly on the best processor of the thread that first accesses the memory).
The variety of prolonged parameters pointed to by ExtendedParameters. If the perform succeeds, the return value is the bottom tackle of the allocated area of pages. If the operate fails, the return worth is NULL. To get extended error info, call GetLastError. This API supplies specialized methods for managing digital memory in assist of high-efficiency video games and server applications. For example, placeholders permit a reserved memory vary to be explicitly partitioned, overlaid, and re-mapped; this can be utilized to implement arbitrarily extendable regions or digital Memory Wave ring buffers. VirtualAlloc2 additionally allows for allocating memory with a selected memory-alignment. Each web page has an related page state. VirtualAlloc2 can commit pages which can be already committed, but can't reserve pages which are already reserved. This means you can commit a variety of pages, no matter whether they have already been dedicated, and the perform will not fail. On the whole nevertheless, only a minimal range of principally uncommitted pages should be specified, because committing numerous pages which are already dedicated could cause the VirtualAlloc2 call to take much longer.