Allocates memory from the current process' memory pool to the current thread's virtual address space.
PVOID AllocateRtMemoryEx( DWORD cbSize // number of bytes to allocate QWORD qwLowFilter, // low physical address limit QWORD qwHighFilter, // high physical address limit DWORD cbAlignment // physical alignment );
cbSize
qwLowFilter
qwHighFilter
cbAlignment
Each process is created with its own virtual address space. All threads within this process share their virtual address space. This call allocates page-aligned pages of physical memory into this virtual address space for use by the calling thread. The call automatically rounds up cbSize (in bytes) to a multiple of 4K. The allocated pages are contiguous; they start and end on 4K boundaries.
The filter parameters cause the memory manager to seek available memory in the range of physical addresses defined by qwLowFIlter and qwHighFilter. For example, to request physical memory from below 4 GBytes you would specify 0 and 0x100000000 for qwLowFIlter and qwHighFilter respectively. If insufficient memory is available between the bounds specified then the call with fail with status E_MEM. To allocate memory from above 4 GBytes you would specify 0x100000000 and 0xffffffffffffff for qwLowFIlter and qwHighFilter respectively.
the cbAlignment parameter allows you to specify a physical alignment for the allocation. The alignment must be specified as a multiple of one page (4 Kbytes). A value of zero specifies the default alignment of one page.
The virtual address space manager finds an available space within the virtual address space of the process and returns a near pointer to the allocated physical memory. The call fails if cbSize bytes of contiguous physical memory are not available, or if there is not enough virtual address space available in the virtual segment. The memory required for page tables is charged to the memory pool of the calling thread's process.
NULL
E_OK 0x0000
E_MEM 0x0002
E_VMEM 0x00F0
E_PARAM 0x8004
cbSize
contains a value larger than the virtual segment size, or 0 (zero).qwLowFilter
is greater than the value of qwHighFilter
.cbAlignement
is not a multiple of 4096. Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 6.2 | intime/rt/include/rtbase.h | rt.h | rt.lib |