RtShrinkMSpace

RtShrinkMSpace shrinks the specified MSpace by the size specified.

Syntax

Copy
BOOL RtShrinkMSpace(
    mspace MSpace,
    ULONG Size
);

Parameters

MSpace

A descriptor to the external or internal MSpace of a 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 (the minimum size may be override by Run /i initial_size option), the number of bytes by which it will shrink may be less than the Size requested.

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. All internal and external MSpace memory is freed at process exit.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

Rtapi.h rtkrnl.lib

See Also: