RtAllocateLocalMemory

RtAllocateLocalMemory allocates memory from the external allocation space (MSpace) of the current process.

Syntax

PVOID RtAllocateLocalMemory(
    ULONG Size
);

Parameters

Size

An unsigned long specifying the number of bytes to allocate.

Return Value

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

Remarks

RtAllocateLocalMemory is a deterministic memory allocation call and can be called in a shutdown handler, provided the memory is available in the MSpace of the process or Subsystem.

NOTE: If the 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 RtAllocateLocalMemory 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, RtAllocateLocalMemory 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, RtAllocateLocalMemory 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.

The returning memory is initialized to zero only if Zero memory at allocation is selected in the RTX64 Control Panel.

Requirements

Minimum Supported Version RTX64 2013
Header Rtapi.h
Library RtApi.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtAllocateLocalMemoryEx

RtQueryProcessMSpace

RtExpandMSpace

RtShrinkMSpace