Fixing ‘Out of Memory’ in MS‑DOS: A Step‑by‑Step Diagnostic Guide
When MS‑DOS reports ‘Out of memory’ despite 640 KB RAM, the problem is usually conventional memory exhaustion. This guide walks through MEM, HIMEM.SYS, DOS=HIGH, DEVICEHIGH, and EMM386.EXE to reclaim space and get applications running.
28 May 2026, 08:16 UTC

Recognizing the Problem
When a DOS program refuses to start and the console flashes Out of memory even though the machine has 640 KB of RAM, the cause is almost always a lack of free conventional memory. Conventional memory is the first 640 KB of the address space that DOS and all resident programs use. If that area is exhausted, DOS can’t load anything new.
Why Conventional Memory Gets Exhausted
- DOS kernel (IBMDOS.COM + IBMBIO.COM) occupies ~64 KB.
- Device drivers and TSRs that are loaded with
DEVICEorLOADconsume conventional memory. - Extended memory (above 1 MB) is inaccessible to 16‑bit DOS programs unless it is first mapped into upper memory blocks (UMB) via HIMEM.SYS or a memory manager.
Diagnostic Checklist
| Check | What to Look For |
|---|---|
1. MEM output | Free conventional memory < 40 KB? |
| 2. HIMEM.SYS loaded? | "HIMEM.SYS" in MEM or boot messages |
| 3. CONFIG.SYS lines | Presence of DOS=HIGH,UMB before any DEVICE |
| 4. Driver placement | Drivers listed with DEVICE vs DEVICEHIGH |
| 5. TSR invocation | TSRs loaded via LOADHIGH? |
| 6. EMM386.EXE status | Is it loaded? With or without NOEMS? |
Step 1 – Run MEM
At the DOS prompt, type:
C:\> MEM
You’ll see a table listing total, used, and free conventional memory. If the free value is below ~40 KB, the system is likely the problem.
Step 2 – Verify HIMEM.SYS
Check the boot messages or the MEM output for a line ending in HIMEM.SYS. If it’s missing, extended memory can’t be mapped into UMB.
Step 3 – Inspect CONFIG.SYS
Open CONFIG.SYS with a text editor and look for:
DEVICE=C:\DOS\HIMEM.SYS
DOS=HIGH,UMB
DEVICE=C:\DOS\SOME.DRV
DEVICEHIGH=C:\DOS\ANOTHER.DRV
DOS=HIGH,UMBtells DOS to load its kernel into the UMB, freeing conventional memory.- Place
DOS=HIGH,UMB**before** anyDEVICElines that load drivers into conventional memory.
Step 4 – Move Drivers to UMB
Replace low‑loaded drivers with DEVICEHIGH where the driver supports it. Example:
DEVICE=C:\DOS\KEYBOARD.DRV ; loads into conventional memory
DEVICEHIGH=C:\DOS\KEYBOARD.DRV ; loads into UMB
Not all drivers support DEVICEHIGH; check the driver’s documentation.
Step 5 – Load TSRs with LOADHIGH
In AUTOEXEC.BAT, replace plain LOAD or CALL with LOADHIGH if the TSR supports it:
LOADHIGH C:\DOS\MEMMAKER.EXE
Step 6 – Use EMM386.EXE for UMBs (Optional)
If you need more than the default 64 KB of UMB, load EMM386.EXE in CONFIG.SYS:
DEVICE=C:\DOS\EMM386.EXE NOEMS
The NOEMS switch disables EMS support, which is unnecessary for most DOS applications and reduces the risk of memory corruption.
Fix Summary
- Add
DEVICE=C:\DOS\HIMEM.SYSandDOS=HIGH,UMBearly inCONFIG.SYS. - Replace low‑loaded drivers with
DEVICEHIGHwhere possible. - Load TSRs via
LOADHIGHinAUTOEXEC.BAT. - Optionally add
EMM386.EXE NOEMSfor extra UMBs.
Verification
- Reboot and run
MEMagain. Free conventional memory should increase by ~46 KB (the size of the DOS kernel) plus any driver/TSR savings. - Launch the previously failing application; it should start without the memory error.
- Optional: run
MEMMAKER /Sto let the optimizer confirm the configuration is near‑optimal.
Escalation Criteria
If, after applying the above fixes, conventional memory remains insufficient:
- Consider installing a third‑party memory manager such as QEMM or 386MAX.
- Upgrade to a newer DOS release (e.g., DOS 5.0 or DOS 6.22) that has improved memory handling.
- Move to a protected‑mode environment (Windows 95/98, OS/2, or a Linux console) where 32‑bit memory addressing is available.
Potential Pitfalls
- Loading too many drivers into UMB can destabilize older chipsets; test after each change.
- Using a HIMEM.SYS version that does not match your CPU (e.g., HIMEM.SYS 2.xx on an 80386) may fail to enable the A20 line, blocking high‑memory access.
- Adding
EMM386.EXEwith theRAMoption on systems lacking compatible extended memory can hang the machine or corrupt memory.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.