Document 1301
Basic Memory Optimization

Description:

 System Memory Optimization

Because the DR DOS 6.0 operating system has been designed to
work with all IBM-compatible personal computers and software
applications, there is no single perfect memory setup that will
optimize memory use for all situations. Memory optimization will
depend both on your particular hardware setup and the software
applications you will be using. However, with a bit of
trial-and-error system fine tuning, you can optimize DR DOS
memory management to meet your particular needs. Below are
techniques and suggestions that will help you optimize your
computer/software setup.

Changing Order of Memory Allocation

The first step in optimizing your system memory can be as simple
as rearranging the order in which memory blocks are assigned by
the config.sys and autoexec.bat files.  The general rule here is
to use upper memory and high memory as much as possible to free
conventional memory for your applications. With this in mind,
you should typically use HIBUFFERS and relocate the DR DOS
kernel code to high memory by using the /BDOS=FFFF option of the
DR DOS memory management drivers, HIDOS.SYS and EMM386.SYS.
Also, if you have any add-on cards that use RAM, make sure that
they are configured so that their RAM is allocated from the
beginning or end of upper memory.  For example, place a network
card immediately above the video RAM area instead of in the
middle of upper memory.

Following this, device drivers and TSRs can be loaded into upper
memory. For best memory allocation, those drivers and TSRs that
occupy the largest blocks of memory should be loaded first and
contiguously. For example, if you need to load three device
drivers and two TSR programs, order them in descending order in
your config.sys file, beginning with the driver that will occupy
the most RAM, to the driver or TSR that will occupy the least
RAM. The documentation for the drivers and TSRs should indicate
the amount of RAM they require; however, if they do not, you can
determine this yourself by using the following procedure:

1. Load the driver or TSR.

2. Use the MEM /U or /B command to see a report of your memory
usage (see Chapter 10 of the DR DOS 6.0 User Guide for a full
description of the MEM command and Chapter 12 regarding loading
device drivers and TSRs).

Expanding Files

If, after determining the size of your drivers and TSRs and
loading them into high memory, a driver or program fails to run
properly or produces an out of memory error message, the problem
might be that the driver or program is expanding itself in RAM.  

Some device drivers and TSR programs occupy a minimal amount of
RAM after they are loaded into memory, but, while initializing,
might actually expand and take up considerably more RAM than
they will ultimately need. Another method of verifying the
program's true RAM size is to load it into conventional memory
(i.e., by deactivating the HIDEVICE, HIINSTALL, or HILOAD
commands), activate the program, and then run the MEM /B command
to see the actual amount of RAM the program occupies. If the
program or driver is expanding itself in RAM, and you want to
load it into upper memory, you will have to allow sufficient
upper memory RAM to accommodate the initialization size of the
program. It might be necessary to use trial-and-error to
determine this size.  See also "Using MemoryMAX with NetWare" on
page 33 for an example.

Example 

In the following example, let's assume you want to load Device
Drivers 1, 2, and 3, and TSR programs 1 and 2, each requiring
the following amounts of memory:

Driver #1       =  13Kbyte of RAM
Driver #2       =  10Kbyte of RAM 
Driver #3       =  16Kbyte of RAM 
TSR #1  =  4Kbyte of RAM 
TSR #2  =  6Kbyte of RAM

Using the MemoryMAX HIDEVICE and/or HIINSTALL commands, enter
these  lines into your config.sys file:

HIDEVICE = C:\DRIVER#3.SYS      ; which uses 16kb RAM 
HIDEVICE = C:\DRIVER#1.SYS      ; which uses 13kb RAM 
HIDEVICE = C:\DRIVER#2.SYS      ; which uses 10kb RAM 
HIINSTALL = TSR#2               ; which uses 6kb RAM 
HIINSTALL = TSR#1               ; which uses 4kb RAM

Note:
There can be exceptions to loading TSRs and drivers in the
"largest first" system described previously. Some device drivers
must be loaded in a specific order. Read the manufacturer's
documentation carefully before installing any driver.

Note that in the above example, you can load the two TSRs with
the HILOAD command placed in the autoexec.bat file. For a
discussion of the MemoryMAX HIINSTALL, HIDEVICE, and HILOAD
commands, see "MemoryMAX System Commands and Drivers" on page 4
in the DR DOS 6.0 User Guide.

LIM Page Frame

Some applications run better with the availability of LIM memory
(sometimes called EMS, or expanded memory). The documentation
for each of your applications will indicate if LIM memory is
required.

If the application does not require LIM memory, be sure that no
LIM page frame is defined. This will save 64 Kbytes of upper
memory. In the EMM386.SYS line of your config.sys file, disable
the page frame with the switch /F=NONE. If using HIDOS.SYS on a
machine with a LIM 4.0 memory card, you can disable the page
frame by specifying /CHIPSET=EMSALL.
