12.5.5 The /CPARM Option

Option

/CP[[ARMAXALLOC]]:number

The /CPARM option sets the maximum number of 16-byte paragraphs needed by the program when it is loaded into memory. The operating system uses this value to allocate space for the program before loading it. This option is useful when you want to execute another program from within your program and you need to reserve memory for the program. The /CPARM option is valid only when linking DOS programs.

LINK normally requests the operating system to set the maximum number of paragraphs to 65,535. Since this is more memory than DOS can supply, the operating system always denies the request and allocates the largest contiguous block of memory it can find. If the /CPARM option is used, the operating system allocates no more space than the option specified. Any memory in excess of that required for the program loaded is free for other programs.

The number can be any integer value in the range 1 to 65,535. If number is less than the minimum number of paragraphs needed by the program, LINK ignores your request and sets the maximum value equal to whatever the minimum value happens to be. The minimum number of paragraphs needed by a program is never less than the number of paragraphs of code and data in the program. To free more memory for programs compiled in the medium and large models, link with /CPARM:1. This leaves no space for the near heap.

NOTE:

You can change the maximum allocation after linking by using the EXEHDR utility, which modifies the executable-file header.