RtShrinkMSpace

RtShrinkMSpace shrinks the specified MSpace by the size specified.

Syntax

BOOL RtShrinkMSpace(
    mspace MSpace,
    ULONG Size
);

Parameters

MSpace

A descriptor to the external or internal MSpace of an RTSS process, as returned by RtGetProcessMSpace. If NULL is specified, the external MSpace of the current process is shrunk.

Size

An unsigned long specifying the size, in bytes, by which to shrink the MSpace.

Return Value

Returns the number of bytes by which the local pool has been shrunk.

Remarks

RtShrinkMSpace allows you to explicitly shrink the internal or external MSpace of a process. It decreases the free memory in the MSpace and returns it back to the Windows non-paged memory pool. If there is not enough free memory in the MSpace, or if the MSpace, when shrunk, will be below the minimum size configured via the RTX64 Control Panel (the minimum size may be override by RtssRun /i initial_size option), the number of bytes by which it will shrink may be less than the Size requested.

Calling RtShrinkMSpace in a Windows process with the MSpace parameter set to NULL will shrink the associated proxy process’ external MSpace.

NOTE: The RtShrinkMSpace call involves an interaction with Windows. As a result, it is non-deterministic and cannot be called in a shutdown handler.

NOTE: A process’ MSpaces can be configured to shrink automatically at the time of allocation, trimming its pool cache, or freeing memory allocated directly from the MSpaces. This shrinking decreases the free memory in the MSpaces. However, it does not shrink the MSpaces below the minimum initial MSpace size. You can disable this automatic shrink feature in the RTX64 Control Panel. All internal and external MSpace memory is freed at process exit.

Requirements

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

See Also:

RtGetProcessMSpace

RtQueryProcessMSpace

RtExpandMSpace