ID Number: Q24935
4.00 5.00 5.10 6.00 6.00a 6.00ax
MS-DOS
Summary:
In Microsoft C versions 5.0, 5.1, 6.0, 6.0a, and 6.0ax, changing the
minimum and maximum allocation values in an .EXE file will affect the
way in which memory is allocated for a program.
Memory is dynamically allocated for a program when it is loaded.
MS-DOS initially attempts to allocate FFFFH paragraphs memory. This
always fails, returning the size of the largest free block. If this
block is smaller than the minimum allocation and the load size, a
no-memory error will occur. If this block is larger than the sum of
the maximum allocation and the load size, MS-DOS will allocate the
amount specified by the load size and the maximum allocation.
Otherwise, the largest block of memory available is allocated.
An example of when the maximum allocation should be changed is a
program, such as a menu driver, that spawns other programs. Because
this program stays resident in memory, the maximum allocation should
be set to the minimum allocation to keep as much memory available as
possible for the spawned programs.
In small memory model, the C startup code returns all memory allocated
to it back to MS-DOS, except for a 64K block reserved for the default
data group. If only 4K of this 64K will be used by the menu program,
the entire 64K should not be kept. There are several ways of changing
the maximum allocation to 4K -- you can link with the /CP:1 option, or
you can modify an existing .EXE file with the EXEHDR or EXEMOD
utility.
Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax