NewDeal Technical Support Document 210

MAXIMIZE YOUR MEMORY


How to optimize your computer's memory

To utilize the information in this document, your computer must:
  1. have at least 1 MB of memory (RAM),
  2. be using MS­DOS 5.0 or newer, DR­DOS 6.0 or newer, Novell DOS 7, Caldera OpenDOS, QEMM, 386Max, or some other memory manager that allows you to use memory above 640K, and
  3. have a 286 or higher processor.
If you aren't familiar with your AUTOEXEC.BAT or CONFIG.SYS file or what they're for, see document number 206 for an introduction.

Overview

Memory management is not specifically a NewDeal issue, but it is not uncommon for our technical support team to receive questions about it. Users will call and say, "When I try to run my DOS program from NewDeal, I get 'Not Enough Memory' errors" or "NewDeal keeps giving me a message that says Conventional Memory is Full."

It's important to remember that "memory" means RAM memory, not free hard disk space. The amount of free space on your hard disk is not related to the amount of memory you have in your computer, or how much of that memory is available.

Every software program has "memory requirements" - a minimum amount of memory it needs to operate. Most software programs need as much of the base 640K of memory (also called conventional memory) as possible. When you boot your computer, memory is taken up by device drivers and TSRs-programs that load into memory from your AUTOEXEC.BAT and CONFIG.SYS files. The key to good memory management is twofold: first, load as few of these programs as possible; second, load as many of these programs as possible into "upper" memory - the memory above the base 640K and below 1 MB.

How Much Conventional Memory Do I Have?

You can find out how much conventional memory is available by entering MEM at any DOS prompt.

MS-DOS will give you a result similar to this:

655360 bytes total conventional memory
655360 bytes available to MS­DOS
468000 largest executable program size
1048576 bytes total contiguous extended memory
0 bytes available contiguous extended memory
983040 bytes available XMS memory
MS-DOS resident in High Memory Area
In this case, MS-DOS reports that out of the 640K of conventional memory, 468,000 bytes (457 K) is free for use by your DOS programs.

DR-DOS 6.0 will give you a result similar to this:

Memory Type Total Bytes (Kbytes) Available (Kbytes)
Conventional 655,360 (640K) 541,424 (528K)
Extended 3,145,728 (3,072K) 3,145,728 (3,072K)
In this case, DR-DOS reports that out of the 640K of conventional memory, 528K is free for use by your DOS programs.

How much conventional memory do I need?

It's a good idea to free up as much of the base 640K as you can. The best source for information on how much base memory is needed to run a certain program is the documentation that came with the program. Often the box that the software is packaged in will indicate how much memory the program requires. But generally, the more conventional memory you have available, the better all of your programs will run.

Maximizing your Conventional Memory

In order to free conventional memory, you use a memory manager, which is a program that allows you to load the TSRs and device drivers in AUTOEXEC.BAT and CONFIG.SYS into upper memory (the memory between the base 640K and the first 1 MB of memory).

You can use virtually any memory manager. HIMEM.SYS and EMM386.EXE are provided with DOS, HIDOS.SYS and EMM386.SYS come with DR-DOS, but you can also use Quarterdeck's QEMM386.SYS or another commercial memory manager. Any of them will make the memory above 640K available for your TSRs and device drivers on a computer with a 386 or higher processor, and on some 286 computers. If your 286 computer cannot use upper memory, it can at least load DOS into high memory. Loading DOS, TSRs, and device drivers into upper or high memory frees up conventional memory.

How to make more Conventional Memory available

The simplest way to free up conventional memory is to use a program that automates the process. These programs will install the memory manager and insert commands into your AUTOEXEC.BAT and CONFIG.SYS files to load your programs above the base 640K. Some of them are MS­DOS 6.x's Memmaker, Quarterdeck's QEMM386, and Qualitas' 386Max. Please be aware that the mention of these products in this document does not constitute an endorsement on the part of NewDeal. A computer consultant or retailer will be able to advise you on the best program to suit your needs. Follow the instructions with the product you choose to free up your conventional memory.

If you elect to do the process yourself, you will need to use a text editor to edit your AUTOEXEC.BAT and CONFIG.SYS files. Add a line to CONFIG.SYS for your memory manager (following the instructions in your DOS manual), then add the appropriate commands to load drivers and TSRs into upper memory.

Here are some sample files from some typical systems (of course yours will look different):

MS-DOS sample configuration files

CONFIG.SYS

device=c:\dos\himem.sys
device=c:\dos\emm386.exe
dos=high,umb
files=30
buffers=30

AUTOEXEC.BAT

c:\dos\smartdrv.exe
lh c:\mouse\mouse
lh c:\mouse\mouse
prompt $p$g

DR-DOS 6.0 sample configuration files

CONFIG.SYS

device=c:\drdos\emm386.sys
hidos=on
hidevice=c:\drdos\ansi.sys
hibuffers=30
files=120

AUTOEXEC.BAT

prompt $p$g
path=c:\drdos;c:\newdeal
hiload c:\mouse\mouse
cd\newdeal
newdeal

Temporarily disabling some programs

You can't load programs into the memory above 1 MB - you can only load programs into conventional memory or into the memory between 640K and 1 MB. The upper memory area has only 384K of memory and some of it is used to control your computer's hardware, such as your video display. Because there is a limited amount of space in the upper memory area, all of the programs loading in your CONFIG.SYS and AUTOEXEC.BAT file may not fit.

If you can't figure out how to use your memory manager, or if you still don't have much conventional memory available, you can temporarily disable some of your drivers and TSRs. To do this, use a text editor to edit your AUTOEXEC.BAT and CONFIG.SYS files. Put the command REM in front of any device driver you don't want or need. In other words, put REM at the beginning of the line that refers to the program you don't want to load. If you put REM in front of a line, then later realize you need to load that program after all, simply delete the REM, save the file, and reboot your computer. If you have compressed your hard drive, be careful not to put REM in front of any disk compression drivers such as Stacker, DblSpace, DoubleDisk, or SuperSTOR.

Before editing your CONFIG.SYS file, be sure you have a system diskette, sometimes called a boot disk. If you make a mistake while editing your CONFIG.SYS file, you may need the system diskette to get your computer started. Instructions for making a boot disk are provided below.

The last resort

One way to free up a lot of memory is to boot from a floppy disk. To accomplish this, simply put a blank disk in your A: drive and enter:
FORMAT A: /S
at any DOS prompt.

Then turn your machine off, wait 15 seconds and turn it back on again, leaving the newly formatted disk in the drive. Your machine may ask you for the time and date, and it will bring you to an A: prompt. You can then type C: to get to the hard drive where you can run your programs. None of the device drivers or TSRs in the CONFIG.SYS or AUTOEXEC.BAT files on your hard drive will be in memory.

Memory and NewDeal

NewDeal will use any available memory - both conventional memory and memory over 1 MB.

To tell NewDeal you have extra memory, launch Preferences, click on Computer, and turn on the memory types that you have available. If in doubt, select all three options: Expanded (LIM/EMS), XMS/HIMEM.SYS, and Extended (over 1 MB). Click OK, then Yes when prompted that the system software needs to be restarted. NewDeal will check for the types of memory available. Memory types that are not available to NewDeal will become deselected again in Preferences, Computer. The Extended (over 1 MB) option will only be selected if you are not loading any memory managers at all.

If only one memory type stays selected, that probably means that all of your memory is configured as one type. For example, if HIMEM.SYS is the only memory manager you are using, the only Extra Memory Type that will stay selected is XMS/HIMEM.SYS.

Also, if you only have 1 MB total memory, and you have a lot of TSRs and other programs taking up memory, there may be no extra memory available by the time NewDeal loads. If you are using DR­DOS 6.0 and TaskMax, you may be using TaskMax options that dedicate blocks of memory for use by TaskMax and limit the amount of extra memory available to NewDeal.

Managed Extended memory (XMS) vs. Expanded memory (LIM/EMS)

Managed Extended memory (XMS) is basically extended memory plus a memory manager like HIMEM.SYS. Expanded memory (LIM/EMS) is memory that is being managed by an expanded memory manager, sometimes a proprietary memory manager that came with your memory chips and board. With some memory managers, you can configure some memory as Expanded and some as XMS. As far as NewDeal is concerned, there is no significant advantage to doing this, but your other DOS programs might benefit from it. See the manual for your particular memory manager for more information.

When you have a choice between setting up your computer to use either XMS or Expanded memory, you have to evaluate which would be best for your particular needs. Some DOS programs can only use Expanded memory.

What NewDeal prefers

When your primary concern is using the best memory for NewDeal, XMS is generally best because it presents fewer compatibility problems. Some TSR programs will load themselves into upper memory without notifying the operating system that they are there, and if you're not using an XMS manager, NewDeal can't tell that the TSR is there and might try to use the same memory. XMS is particularly nice if the XMS memory manager can provide with upper memory blocks - memory that lies between 640K and 1 Mb - as you can often load device drivers and TSRs into that memory space. An example is QEMM386 with its "RAM" option or EMM386.EXE with the "noems" option.

Expanded memory (EMS) provides faster swapping time (as NewDeal doesn't have to enter and leave protected mode to use it as swap space) and EMS provides an additional 48K of memory to the pool that applications can use directly. However, the speed difference between XMS and EMS is so small as to not be noticeable on most systems. Using XMS might allow more of your TSRs and device drivers to load into upper memory, which results in more free conventional memory--a Good Thing.

Windows 95 or 98

In many cases, Windows 95 or 98 will do the best job of managing your computer's memory if you do not use any DOS memory managers. To let Windows manage your memory, remove or REMark out any lines in your CONFIG.SYS file that load HIMEM.SYS or EMM386.EXE. On many computers, you don't need a CONFIG.SYS file at all.

Some customers ask, "When I load EMM386 in my CONFIG.SYS file with the NOEMS switch, I can get as much as 624K free conventional memory. When I let Windows manage my memory, the best I can get is 590K. How can this be better?" The answer is: Windows can provide NewDeal with both EMS and XMS memory on demand (assuming the default configuration for the Memory tab in your shortcut's Properties). With EMS, NewDeal treats 48K of UMBs as if it was conventional memory. 590K plus 48K is more than 624K.

RAM Drives

Swapping to a RAM drive is less efficient than allowing NewDeal to swap directly to free expanded or extended memory, but is still preferable to swapping to the hard drive. Obviously, when NewDeal runs out of RAM, it will have to swap to the hard drive and this will slow down performance. To make sure NewDeal is running as efficiently as possible, give it as much extended or expanded RAM as you can and avoid using RAM drives.

Handles

In the NewDeal section of Preferences, there is a setting for the number of "handles" available to NewDeal. A handle is basically a pointer to a place where NewDeal has stored information. The number initially assigned (3500) should be enough and you should not need to change this setting.

Real, Protected, and Virtual Memory

A brief introduction to the history of processors and operating modes.

The original 8088 processor was designed to directly address only 640k. It can actually address more but the additional address space is reserved for system uses and is not available to software applications. The 8088 is also a single-threaded processor and can only handle one task at a time. It wasn't called anything at first because it was the only method available, but this mode of operation is now called REAL mode.

The 80286 processor was designed to operate in either of two different modes, REAL and PROTECTED. The REAL mode is downward compatible with the earlier 8088 and has all the same capabilities and limitations, including the 640k memory limit. But the 286 can also operate in PROTECTED mode. This uses a completely different set of circuitry in the chip and has several features not found in REAL mode. First, it is not limited to 640k as the chip can directly address 16meg of memory when in this mode. Due to built in support for virtual memory (page swapping), software applications can actually address up to one gigabyte of memory. In addition, the 286 provides direct hardware support for multi-tasking in this mode. It also provides memory protection (thus the name) which prevents a task running in one block of memory from invading the memory being used by another task. The downside of PROTECTED mode is that it is totally incompatible with applications written for REAL mode, including MS DOS itself. OS/2 is an example of an operating system that runs entirely in protected mode.

Finally, along came the 80386. The 386 retained both REAL and PROTECTED mode operation to be downward compatible with earlier processors, but added some new features. First of all, the enlarged 32 bit address bus allows the chip to directly address a whopping four gigabytes of memory with virtual memory addressing of 64,000 gigabytes! Another feature of the 386 chip is the addition of VIRTUAL REAL mode. This mode utilizes the virtual memory mapping features of the chip which allows it to slice up the PC's memory into separate partitions, each of which then appears to be its own little PC (a virtual machine) operating in REAL mode. This allows downward compatibility with REAL mode applications while retaining the ability to multi-task at the hardware level. When Microsoft Windows says it is running in "Enhanced" mode and multi-tasking DOS apps, it is really the 386 chip that is doing the work via this VIRTUAL REAL processing mode. This is why Windows Enhanced mode requires a 386 machine to operate.

Adam's famous memory explanation

Adam deBoor, one of the software engineers who helped design the memory management used by NewDeal software, wrote this brief explanation about extended memory which has become a standard around our offices.

XMS has three types of memory to offer an application: upper, high and extended.

Upper memory lives between 640K and 1 MB and is usually provided only with the help of a 386 (QEMM, 386MAX with the RAM option) or a special chip set or an EMS board. If an XMS manager supports upper memory blocks, our software will allocate as many as are available (up to 10) and give it to the heap to parcel out to applications just as if the blocks were part of the conventional 640K--the applications never know the difference.

High memory is the 64K-16 bytes that can be accessed at the 1 MB boundary on a 286 and above, owing to a quirk of the address calculation. If this is available when our software starts up, it will use this memory, but only for swapping as DOS can't access memory up here (it "normalizes" all pointers it's given, so any pointer to this area gets wrapped down to the interrupt table at the bottom of memory). Our software can swap to this 63K faster than it can to the rest of extended memory, as it doesn't have to go to and from protected mode to do it.

Extended memory is anything beyond the first 63K. Our software will use the largest free block of extended memory the XMS manager has to offer and will swap to it using XMS functions. This is, of course, a little slow, but not as slow as swapping to disk.

When in the presence of EMS (expanded memory), our software takes the 64K page frame provided by a 3.0-compliant EMS manager and maps 3 16K pages to the lower 48K and gives it to the system in the same way as upper memory is used -- those 48K are parceled out automatically among the applications as requested and they never know the difference. The remaining 16K page is used for swapping, with data being copied to the 16K page until no more will fit, at which point the current EMS page that is mapped there is mapped out and another EMS page from the set the software allocated at start-up is mapped in its place, and the swapping continues. The software doesn't use the expanded page frame offered by some EMS 4.0-compliant managers and boards.

Given a choice between having memory be expanded and extended, I would always choose expanded, both for the extra 48K it provides for immediate use by applications (it's amazing the difference 48K makes in system performance), and for the increased speed of swapping (not having to go in and out of protected mode to copy the data), as well as the lessened chance of losing serial port interrupts while in protected mode.

If presented with just raw extended memory, no XMS driver, the software just uses the whole thing as swap space, employing the BIOS block move function to copy the data to and fro.

For More Help

Entire books have been written on memory management. We have tried to give you some essentials in this document. If you need more information, check your DOS manual for a section on memory management or optimization, or consider using a program like Quarterdeck's QEMM, Qualitas' 386Max, or Microsoft's Memmaker, which handle the configuration for you.

Definitions

Conventional memory
The first 640K of RAM in your computer, also called the base memory.
Upper Memory
The 384K of memory above 640K and below the first 1 MB. Some of this memory is used by your computer for various functions, including controlling the monitor.
High Memory Area
The first 64K of memory above the first MB. You can load DOS into this area if you have DOS=HIGH in your CONFIG.SYS file.
Extended or XMS memory
Memory above the first 1 MB that is being managed by an extended memory manager, such as HIMEM.SYS.
Expanded or LIM/EMS memory
Memory above the first 1 MB that is being managed by an expanded memory manager. A few extended memory managers will allow you to configure both expanded and extended memory.
Handle
In NewDeal, a handle is a pointer to a memory block where NewDeal has stored program data or document information.
Back to Index

Last Modified 15 Feb 1999