RtAllocateLocalMemoryEx

RtAllocateLocalMemoryEx allocates memory from a pre-allocated RTSS local memory pool to avoid SRI activity if allocating memory from the Windows memory pool. With allocation option, RtAllocateLocalMemoryEx allows you to allocate memory without zero-initializing the memory region.

Syntax

PVOID RtAllocateLocalMemoryEx(
    ULONG Size
    ULONG Flags
);

Parameters

Size

An unsigned long specifying the number of bytes to allocate.

Flags

The memory allocation option. This parameter can be one or more of the following values:

Value Meaning
RTALLOC_NOT_ZERO_MEMORY The allocated memory will not be initialized to zero. Otherwise, the memory is initialized to zero.

Return Value

A pointer to the memory if the function succeeds, a NULL pointer if the function fails

Remarks

RtAllocateLocalMemoryEx allocates memory in the virtual address space of the process, backed by non-paged memory. Since RtAllocateLocalMemoryEx allocates memory from a pre-allocated RTSS memory pool, this is a deterministic memory allocation call and can be called in a shutdown handler.

NOTE: If the RTSS memory pool has not been created yet or if the amount of free memory in the pool is not enough for the requested Size, there is Windows interaction involved in an RtAllocateLocalMemoryEx call and the deterministic feature is lost. To avoid that, call RtQueryLocalMemory first to make sure there is enough free memory in RTSS memory pool.

NOTE: If the RTSS local memory pool has not been created yet, RtAllocateLocalMemoryEx will initialize the pool with a size equal to the greater of the Size parameter or the local memory pool configured via the RTX64 Control Panel. If the amount of free memory in the pool is not enough for the requested Size, RtAllocateLocalMemoryEx will implicitly expand the pool with a size equal to the max{ LocalMemoryExpandSize, Size }. You can disable this implicitly expand feature by settings in the RTX64 Control Panel.

Requirements

Minimum Supported Version RTX64 2013
Header RtssApi.h
Library Rtx_Rtss.lib

See Also:

RtFreeLocalMemory

RtQueryLocalMemory