Maximizing Conventional Memory in MS-DOS 5.0–6.22 with HIMEM.SYS and EMM386.EXE
Step-by-step guide to freeing conventional memory in MS-DOS 5.0–6.22 by loading the DOS kernel into the HMA and moving drivers/TSRs into UMBs using HIMEM.SYS and EMM386.EXE. Includes CONFIG.SYS and AUTOEXEC.BAT examples, MEM verification commands, and recovery procedures for boot failures.
30 May 2026, 07:39 UTC

The Problem: Conventional Memory Ceiling
MS-DOS applications can only address the first 640 KB of RAM, known as conventional memory. Device drivers, terminate-and-stay-resident programs (TSRs), and the DOS kernel itself consume this space, often leaving too little for large programs such as spreadsheets, databases, or games. The solution is to relocate as much of this overhead as possible into two regions above 640 KB: the High Memory Area (HMA) — the first 64 KB of extended memory — and Upper Memory Blocks (UMBs) — unused gaps in the 640 KB–1 MB address range reserved for hardware ROMs.
Desired Outcome
After configuration, MEM /C /P should report Total conventional memory free above 600 KB, the HMA showing MS-DOS resident, and multiple drivers/TSRs listed under Modules using upper memory. The target application must launch without an "Out of memory" error.
Prerequisites
- MS-DOS 5.0, 6.0, 6.2, or 6.22 installed on the boot drive (C:).
HIMEM.SYS(XMS driver) andEMM386.EXE(EMS/UMB provider) present in the DOS directory (typicallyC:\DOS).- An Intel 80386 or later CPU —
EMM386.EXErequires 386 protected-mode features. - Backups of the original
CONFIG.SYSandAUTOEXEC.BATon a separate floppy or partition.
Procedure: CONFIG.SYS Configuration
Edit C:\CONFIG.SYS with a text editor (e.g., EDIT). Order is critical: HIMEM.SYS must load first, then EMM386.EXE, then the DOS=HIGH,UMB directive.
DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF
DEVICE=C:\DOS\EMM386.EXE NOEMS I=B000-B7FF
DOS=HIGH,UMB
DEVICEHIGH=C:\DOS\ANSI.SYS
DEVICEHIGH=C:\DOS\SETVER.EXE
FILES=30
BUFFERS=20
Parameter notes:
/TESTMEM:OFFskips the extended memory test at boot, saving several seconds.NOEMSdisables Expanded Memory Specification (EMS) page framing, freeing more UMB space for drivers. UseRAMinstead if any application requires EMS.I=B000-B7FFincludes the monochrome video ROM region as usable UMBs. Adjust or addX=(exclude) ranges for network adapter ROMs, SCSI BIOS, or VGA BIOS atC000-C7FF. RunMEM /Dafter first reboot to see actual UMB layout.DEVICEHIGH=loads the specified driver into a UMB instead of conventional memory.
Procedure: AUTOEXEC.BAT Configuration
Edit C:\AUTOEXEC.BAT. Prefix each TSR with LOADHIGH (or its alias LH) to request UMB placement.
@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS
LH C:\DOS\MOUSE.COM
LH C:\DOS\MSCDEX.EXE /D:MSCD001
LH C:\DOS\SMARTDRV.EXE 2048 1024
SET TEMP=C:\TEMP
SMARTDRV.EXE parameters shown are cache size (2 MB) and minimum free space (1 MB); adjust for your disk size.
Expected Checks After Reboot
- At the command prompt, run
MEM /C /P. Verify:- Total conventional memory free ≥ 600 KB.
- High memory area line reads
MS-DOS resident. - Upper memory blocks section lists
ANSI.SYS,MOUSE.COM,MSCDEX.EXE,SMARTDRV.EXE(or your specific drivers/TSRs).
- Run
MEM /Dto inspect UMB fragmentation. Each block shows Free or a module name. If large gaps remain but drivers failed to load high, UMBs may be fragmented — see Cautions. - Launch the target application (e.g.,
123.EXEfor Lotus 1-2-3,DOOM.EXE). Confirm it starts without memory errors.
Recovery Options
If the system hangs, displays "Device driver not found," or reports "UMB not available":
- F5 during "Starting MS-DOS..." bypasses both
CONFIG.SYSandAUTOEXEC.BATentirely, booting to a minimal environment. - F8 enables step-by-step confirmation for each line in both files; press
Non the problematic line. - Boot from a clean floppy containing only
DEVICE=A:\HIMEM.SYSinCONFIG.SYS, then copy your backed-upCONFIG.SYSandAUTOEXEC.BATback toC:\.
Cautions and Common Pitfalls
- Hardware conflicts: Some network cards (e.g., 3Com 3C509) or SCSI host adapters reserve UMB ranges that
EMM386must exclude. AddX=C800-CFFF(or the adapter's documented range) to theEMM386.EXEline. - UMB fragmentation: If
MEM /Dshows many small free blocks butDEVICEHIGH/LOADHIGHfails, tryFRAME=E000on theEMM386.EXEline to force a 64 KB page frame at a different address, or switch toRAMmode (enables EMS) which reorganizes UMBs differently. - Third-party memory managers: QEMM, 386MAX, or Helix Netroom replace Microsoft's drivers entirely. Do not mix them with
HIMEM.SYS/EMM386.EXE— instability will result. - TSR refusal: Certain TSRs (e.g., older
SHARE.EXE, some copy-protection drivers) cannot relocate. They remain in conventional memory, limiting gains. Check vendor documentation for/Hor/LHswitches. - Line ordering:
DOS=HIGH,UMBmust appear after bothHIMEM.SYSandEMM386.EXE. Placing it earlier prevents UMB creation.
Verification Checklist
| Check | Command | Pass Criteria |
|---|---|---|
| Conventional memory free | MEM /C | ≥ 600 KB |
| Largest executable program size | MEM /C | Approaches 600 KB |
| HMA status | MEM /C | Shows "MS-DOS resident" |
| UMB module list | MEM /D | All intended drivers/TSRs appear under "Modules using upper memory" |
| Application launch | Run target app | No "Out of memory" error |
| Stability | Multiple warm/cold boots + typical workload | No hangs, crashes, or data corruption |
Limitations
This approach applies only to real-mode MS-DOS 5.0–6.22 on 386+ hardware. It does not apply to Windows 3.1x running in 386 Enhanced Mode (which uses its own virtual memory manager), nor to DOS extenders (DPMI) that bypass conventional memory entirely. Maximum conventional memory free is bounded by the number and size of UMBs available on a given machine — typically 600–620 KB is the practical ceiling.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.