INtime SDK Help
INtime SDK v7.1 > About INtime > INtime Kernel > Memory management > AllocateRtMemory

Allocates memory from the current process' memory pool to the current thread's virtual address space.

PVOID AllocateRtMemory(
    DWORD cbSize    // number of bytes to allocate


Number of bytes to allocate to the virtual segment.


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 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.

Return Values

A pointer to the address to where the memory has been allocated in the thread's virtual address space.
Failure. To determine the status, call GetLastRtError.


E_OK 0x0000
No exceptional conditions occurred.
E_MEM 0x0002
This request requires more available physical memory than currently exists.
E_VMEM 0x00F0
Satisfying this request requires more virtual memory than is available to the process.
E_PARAM 0x8004
cbSize contains a value larger than the virtual segment or 0 (zero).


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/rtbase.h rt.h rt.lib
See Also