Out-of-Memory Problems for DOS


How much memory does your DOS program require? If the System Requirements listing for your program say 640K memory or 4MB RAM, then you don't know; these numbers simply tell you what the total system memory should be, not the amount of available memory. Some examples of good memory requirements are 586K conventional memory and 2560K extended memory.

First of all, it would help to know that PC-compatible computers use several different kinds of memory. DOS programs mostly stick with conventional memory, because that has been around since the 8086 and is still used for backwards compatibility. Conventional memory has a limit of 640K in all Intel x86 processors, including the Pentium, and there is absolutely no way to increase that space. The other two types of memory are easily confused: expanded and extended. Expanded memory was just a hack used on the 80286; it's no longer real, but can be faked using extended memory. Extended memory is all the rest of the memory on your computer except for the first 1MB.

So, you need to know how much conventional memory your program needs, how much extended memory, and whether it uses expanded memory. Once you find those number, then you need to know what your computer has available. At the DOS prompt, type MEM. This will give you a display similar to:

Memory Type     Total       Used       Free
----------------  --------   --------   --------
Conventional          640K        64K       577K
Upper                  75K        75K         0K
Reserved              384K       384K         0K
Extended (XMS)      2,997K       249K     2,748K
----------------  --------   --------   --------
Total memory        4,096K       772K     3,325K

Total under 1 MB      715K       138K       577K

Total Expanded (EMS)                    3M (3,522,560 bytes)
Free Expanded (EMS)                     3M (3,522,560 bytes)

Largest executable program size       576K (590,320 bytes)
Largest free upper memory block         0K       (0 bytes)
MS-DOS is resident in the high memory area.

This example shows that my computer has 577K conventional memory free for DOS programs, and 2,748K extended memory free. It also shows that my computer is pretending it has expanded memory.

What can you do if the total memory is ok, but you don't have enough memory available? The most common procedure is to stop loading programs into memory. Try typing MEM /C /P from the DOS prompt; this will list the programs that are in conventional memory as well as how much memory each one is using. Notice also that there is yet another type of memory: upper. This is the memory area normally reserved for hardware, but not all of it will be in use, so the computer can make use of the 'holes'. In the above example, I had no upper memory available, but if you do, you can move whatever programs are small enough to fit there by changing the keyword DEVICE to DEVICEHIGH if the program is loading in the CONFIG.SYS file, or by adding LH in front of the command if it loads from your AUTOEXEC.BAT file.

Let's say you did that already, and there still isn't enough conventional memory available for your program. What then? Well, you'll have to take a closer look at the CONFIG.SYS and AUTOEXEC.BAT files and decide if you really need all those programs. The best way to experiment with this, if you have DOS 6.2 or later, is to reboot your computer and press the F8 key right when it says "Starting MS-DOS". The you can pick and choose which programs get started and which ones don't. Here are a few tips:

If you're short on extended memory, the primary hog in that department is SMARTDRV. Try disabling that in your AUTOEXEC.BAT file, or using a lower cache size.


Return to index