Check Memory Fragmentation in MS-DOS 6.22
In MS-DOS 6.22, memory fragmentation occurs when free conventional or
upper memory is split into non-contiguous blocks, often preventing
larger programs or drivers from loading. This article explains how to
use the built-in MEM command with specific
switches—primarily MEM /F and MEM /D—to
inspect memory allocation, identify fragmented free blocks, and
determine whether your system's memory layout requires optimization.
The Primary Command: MEM /F
The most direct way to check for memory fragmentation in MS-DOS 6.22
is the MEM /F (or MEM /FREE) command. This
switch displays an inventory of all currently unallocated memory blocks
in both conventional memory and Upper Memory Blocks (UMBs).
To run the command, enter:
MEM /F
When you execute this command, MS-DOS lists each free memory segment along with its segment address and size.
- Evaluating the Output: If the command displays a single large free block in conventional memory, your memory is contiguous and unfragmented. If the output displays multiple free blocks separated across different segments, memory fragmentation is present.
- Largest Executable Program Size: Comparing the "Largest executable program size" to the "Total free conventional memory" at the bottom of the report will immediately show the impact of fragmentation. A noticeable difference between the two values indicates that free memory is broken into pieces rather than available as a single contiguous space.
In-Depth Inspection: MEM /D
For a comprehensive view of how programs and drivers are arranged
around free memory, use the MEM /D (or
MEM /DEBUG) switch:
MEM /D | MORE
The /D switch outputs the entire Memory Control Block
(MCB) chain in order of physical segment addresses. It lists:
- Device drivers and system data areas.
- Active Terminate-and-Stay-Resident (TSR) programs.
- Every individual free memory block situated between loaded modules.
By reviewing the address sequence, you can determine exactly which TSR or driver is dividing your memory space and causing fragmentation.
Resolving Fragmentation Issues
If MEM /F reveals high fragmentation levels that prevent
applications from running, you can resolve the issue by optimizing your
system startup files:
- Reorder TSRs in AUTOEXEC.BAT: Load persistent utilities before temporary ones, or load larger TSRs first.
- Reorder CONFIG.SYS: Place device drivers strategically so that persistent system files reside at lower memory addresses.
- Run MemMaker: MS-DOS 6.22 includes the automated
optimization utility
MEMMAKER. Running this tool analyzes your system configuration and automatically calculates the most efficient loading order for drivers and TSRs into Upper Memory Blocks (UMBs), eliminating conventional memory fragmentation.