8.2.8 Memory-Management Functions

MS-DOS provides Interrupt 21h functions for allocating and freeing memory. The system keeps track of memory allocations by using a memory control block at the beginning of each allocated area. To avoid overwriting memory control blocks, other resident programs, or portions of the operating system or device drivers, programs should use the MS-DOS memory-management functions and use only allocated memory.

Following are the MS-DOS memory-management functions:

Function Description Version

48h Allocate Memory 2.0
49h Free Allocated Memory 2.0
4Ah Set Memory Block Size 2.0
5800h Get Allocation Strategy 3.0
5801h Set Allocation Strategy 3.0
5802h Get Upper-Memory Link 5.0
5803h Set Upper-Memory Link 5.0