How Min/Max Memory Allocations Effect Program LoadingLast reviewed: July 17, 1997Article ID: Q24935 |
5.10 6.00 6.00a 6.00ax 7.00 | 1.00 1.50
MS-DOS | WINDOWSkbprg
The information in this article applies to:
SUMMARYChanging the minimum or maximum allocation values in an executable file affects the method in which MS-DOS allocates memory for the application.
MORE INFORMATIONMS-DOS dynamically allocates memory for an application when it is first loaded. Initially, MS-DOS attempts to allocate FFFFh paragraphs of memory. This attempt always fails and the memory manager returns the size of the largest free block of memory. If this block is smaller than the minimum allocation and the load size, a "no memory" error occurs and MS-DOS cannot load the application. If the largest free block is larger than the sum of the maximum allocation and the load size, MS-DOS allocates the amount specified by the sum of the maximum allocation and the load size. Otherwise, MS-DOS allocates the largest free block for the application. Usually, the default maximum allocation is sufficient for a given application. However, there are cases in which changing the maximum allocation provides better functionality. One such case is a menu program that spawns other programs. Because the menu program remains in memory, this maximum allocation should be set as low as possible to maximize the memory available to the spawned applications. In the small memory model, the C startup code returns to MS-DOS all memory allocated for the application except for a 64K block reserved for the default data segment. If an application uses only 4K in its default data segment, it can return the remaining memory to MS-DOS as well. To change the maximum allocation to 4K, specify the /CP:1 option on the Microsoft LINK command line or use the EXEHDR or EXEMOD utilities to modify an existing executable file. For more information, see the LINK, EXEHDR, or EXEMOD documentation.
|
Additional reference words: kbinf 1.00 1.50 5.10 6.00 6.00a 6.00ax 7.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |