5.2.1 Program Memory

When loading a program, MS-DOS allocates a certain amount of memory for it, depending on the type of program. For .COM programs, MS-DOS allocates all available memory. For .EXE programs, it allocates all available memory up to the amount requested in the program's file header. If MS-DOS cannot allocate enough memory to load a program, it terminates the request and returns an error value. The minimum amount of memory required for loading depends on the type of program file. For information about loading programs, see Section 5.7, “Program-File Formats.” .COM program>.EXE program>

A program can use any memory allocated for it by the system and can free any extra memory so that it is available for other programs. Programs that will run other programs must free enough memory to load them.