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. DOS 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 for DOS programs.

LINK normally requests DOS to set the maximum number of paragraphs to 65,535. Since this is more memory than DOS can supply, DOS always denies the request and allocates the largest contiguous block of memory it can find. If the /CPARM option is used, DOS 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 the minimum value. This minimum 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. For more infor-mation on EXEHDR, see Chapter 17.