SetSwapAreaSize

2.x

  LONG SetSwapAreaSize(cCodeParagraphs)    
  UINT cCodeParagraphs; /* number of paragraphs for code */

The SetSwapAreaSize function sets the amount of memory that an application uses for its code segments.

Parameters

cCodeParagraphs

Specifies the number of 16-byte paragraphs requested by the application for use as code segments. If this parameter is zero, the return value specifies the current size of the code-segment space.

Return Value

The return value is the amount of space available for the code segment, if the function is successful. The low-order word specifies the number of paragraphs obtained for use as a code-segment space (or the current size if the cCodeParagraphs parameter is zero); the high-order word specifies the maximum size available.

Comments

If cCodeParagraphs specifies a size larger than is available, this function sets the size to the available amount. The maximum amount of memory available is one half the space remaining after Windows is loaded.

Calling this function can improve an application's performance by preventing Windows from swapping code segments to the hard disk. However, increasing the code-segment space reduces the amount of memory available for data objects and can reduce the performance of other applications.

See Also

GetNumTasks, GlobalAlloc