Choosing HIMEM.SYS vs EMM386.EXE for Conventional Memory Optimization in MS‑DOS
Decide whether to load only HIMEM.SYS or combine it with EMM386.EXE to create Upper Memory Blocks, and see how to configure CONFIG.SYS and verify the result.
06 Sept 2025, 17:30 UTC

Problem Statement
Running memory‑hungry DOS applications (e.g., Turbo C, large spreadsheets, or games) often fails with the classic Out of memory error. The culprit is the limited 640 KB of conventional memory that DOS can address directly. Extended memory managers (EMMs) can expose additional memory, but the way they do so matters. Two common managers are HIMEM.SYS and EMM386.EXE. Choosing the right combination can free up tens of kilobytes of conventional memory for your programs.
Decision to Make
Should you load only HIMEM.SYS, or should you add EMM386.EXE to create Upper Memory Blocks (UMB) for drivers and TSRs? The answer depends on your hardware, software stack, and how much conventional memory you need.
Constraints
- Processor: 80286 or newer (required for
HIMEM.SYS) - RAM: Minimum 1 MB (necessary for HMA, XMS, and UMB)
- BIOS: Must support 286+ memory mapping; buggy chipsets may stall when UMBs are enabled
- CONFIG.SYS order: Device drivers that need UMB must be listed before any TSRs that rely on them
Options Comparison
| Option | Memory Provided | Typical Conventional Memory Saved | Complexity |
|---|---|---|---|
| HIMEM.SYS only | HMA (64 KB) + XMS | ~0 KB (HMA used by DOS itself) | Low |
| HIMEM.SYS + EMM386.EXE (no UMB) | HMA + XMS + EMS | ~0 KB | Medium |
| HIMEM.SYS + EMM386.EXE with UMB | HMA + XMS + UMB (up to 64 KB) | Up to ~64 KB | Medium‑High |
| No extended manager | None | 0 KB | None |
Trade‑offs
- HIMEM.SYS only keeps the configuration simple and guarantees that all drivers stay in low memory. However, it offers no UMBs, so drivers that could otherwise be moved to upper memory remain in conventional memory, limiting the amount available to applications.
- Adding EMM386.EXE with UMB allows you to relocate drivers and TSRs into the 64 KB of upper memory, freeing that space for your programs. The trade‑off is a more complex
CONFIG.SYSand a slight risk of incompatibility on older 286 boards that cannot handle UMB mapping. - Using EMM386.EXE without UMB gives you EMS (Expanded Memory Specification) support, useful for applications that rely on EMS, but it does not free conventional memory.
- Skipping both managers is the simplest path but offers no memory optimization.
Concrete Implementation
Step 1 – Edit CONFIG.SYS
Place the following lines in CONFIG.SYS. Replace C:\\DOS with the actual path to your MS‑DOS installation if different.
DEVICE=C:\\DOS\\HIMEM.SYS
DEVICE=C:\\DOS\\EMM386.EXE NOEMS
DOS=HIGH,UMB
DEVICE=C:\\DOS\\HIMEM.SYSloads the High Memory Area (HMA) and XMS support.DEVICE=C:\\DOS\\EMM386.EXE NOEMSloads the 386 EMM, disables EMS if you do not need it, and prepares UMB support.DOS=HIGH,UMBtells DOS to move the DOS kernel into the HMA and to create UMBs for drivers and TSRs.
Ensure that any DEVICE= entries that need UMB come before the DOS=HIGH,UMB line. If you have TSRs that require UMB, list them after the DOS=HIGH,UMB line.
Step 2 – Reboot and Verify
After rebooting, run the DOS memory manager to confirm that UMBs are allocated:
MEM /C
Look for a line such as Upper memory block size: 64 KB. This indicates that 64 KB of conventional memory has been moved to upper memory. The MEM /D command will display a detailed distribution of conventional, high, and upper memory usage.
Step 3 – Test with a Memory‑Intensive Application
As a practical check, start a program that historically runs out of memory, such as Turbo C 3.0, and confirm it compiles large projects without error. Successful compilation implies that conventional memory is now sufficient.
Common Pitfalls and Mitigation
- NOEMS Switch: Use
NOEMSonly if your applications do not require EMS. If you need EMS, omit the switch to provide EMS compatibility. - Hardware Compatibility: Some early 80286 boards with buggy memory controllers may hang when UMBs are enabled. Test stability with a simple
MEM /Cbefore loading large applications. - Driver Order: Incorrect ordering of
DEVICE=lines can prevent drivers from loading into UMB, causing them to occupy conventional memory. Follow the order guidelines above.
Practical Example
Assume a system with 1 MB of RAM and a 286+ processor. The following CONFIG.SYS frees 64 KB of conventional memory:
# Sample CONFIG.SYS
DEVICE=C:\\DOS\\HIMEM.SYS
DEVICE=C:\\DOS\\EMM386.EXE NOEMS
DOS=HIGH,UMB
After reboot, a MEM /C output might look like:
Conventional memory: 640 KB ( 640 KB available)
Upper memory block size: 64 KB
High memory area: 64 KB
Running Turbo C now compiles a 200 KB source file without hitting the memory limit.
Conclusion
For most DOS users needing a modest increase in conventional memory, loading HIMEM.SYS alone is sufficient. If you regularly run applications that push the 640 KB boundary, adding EMM386.EXE with the UMB switch is the optimal choice, provided your hardware supports it. Always verify with MEM /C and test with a memory‑intensive program before relying on the configuration for production use.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.