INF: Initial Memory Allocation of C Programs

ID Number: Q23905

4.00 5.00 5.10 6.00 6.00a 6.00ax 7.00

MS-DOS

Summary:

In Microsoft C versions 5.0, 5.1, 6.0, 6.0a, 6.0ax, and C/C++ version

7.0, special attention must be paid to linking a program intended to be

a "terminate-and-stay-resident" (TSR) program.

For example, a very short program with only 4K of data and about 2K of

code may result in an executable that is about 70K in size.

More Information:

The linker normally allocates all available memory to a program. You

can use the /CP switch to adjust the allocation down. If you specify

an amount less than the minimum allocation, the maximum allocation

will default to that minimum, so link with /CP:1.

You can also use the /max <MinimumAllocationInHexParagraphs> option of

the EXEMOD.EXE utility to adjust the maximum allocation of a program.

Microsoft C was not designed for writing memory resident software.

Although it is possible, you also may need to make modifications to

the start-up code. Be cautious about what functions you use and what

MS-DOS functions are called.

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00