How to Change the Way MS-DOS Allocates Memory (59121)
The information in this article applies to:
• Microsoft MS-DOS operating system 3.1
• Microsoft MS-DOS operating system 3.2
• Microsoft MS-DOS operating system 3.21
• Microsoft MS-DOS operating system 3.3
• Microsoft MS-DOS operating system 3.3a
• Microsoft MS-DOS operating system 4.0
• Microsoft MS-DOS operating system 4.01
• Microsoft MS-DOS operating system 5.0
This article was previously published under Q59121
SUMMARY
When MS-DOS allocates memory for your program, it uses a first-fit
allocation strategy by default. You can change MS-DOS's default
strategy to a best fit, last fit, or back to first fit with a call to INT 21h Function 58h.
MORE INFORMATION
A first-fit strategy forces MS-DOS to search from low addresses in
memory to high addresses, and allocate the first available block of
memory large enough for the requested allocation.
A best-fit strategy forces MS-DOS to search all addresses in memory
and allocate the smallest block still large enough to fill the
requested allocation.
A last-fit strategy forces MS-DOS to search from high addresses in
memory to low addresses, and allocate the first available block of
memory large enough for the requested allocation.
The best-fit algorithm is the slowest to execute since all free memory
is searched, but results in the least memory fragmentation during
multiple allocations and frees. Conversely, the first-fit and last-fit
strategies are fastest to execute but result in a higher degree of
memory fragmentation.
Modification Type: |
Major |
Last Reviewed: |
11/26/2003 |
Keywords: |
KB59121 |
|