RtAllocateLocalMemoryEx

RtAllocateLocalMemoryEx allocates memory from the external memory allocation space (MSpace) of the current process. 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 will be initialized to zero if Zero memory at allocation is selected in RTX64 Control Panel.

Return Value

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

Remarks

RtAllocateLocalMemoryEx is a deterministic memory allocation call and can be called in a shutdown handler, provided the MSpace contains the requested memory.

NOTE: If the MSpace’s local 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 RtQueryProcessMSpace first to make sure there is enough free memory in the MSpace.

NOTE: If the MSpace’s local pool has not been created yet, RtAllocateLocalMemoryEx will initialize the pool with a size equal to the greater value of the Size parameter or the minimum size threshold 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{ MSpacePoolExpandSize, Size }. You can disable this implicitly expand feature overall through the RTX64 Control Panel or individually by using RtssRun /e with nExpandSize equal to 0.

Requirements

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

See Also:

RtAllocateLocalMemory

RtQueryProcessMSpace

RtExpandMSpace

RtShrinkMSpace