bas7qck.hlp (Table of Contents; Topic list)
Using Expanded Memory (EMS)
  Memory and Capacity                          Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Using Expanded Memory
QBX can use expanded memory to move certain kinds of program code and data
out of conventional memory. ISAM can use up to about 1.2 Mb of expanded
memory as buffer space for the ISAM Terminate and Stay Resident (TSR)
programs. You can set the amount of expanded memory used by ISAM and QBX as
decribed below.
 
ISAM Use of Expanded Memory
By default, the ISAM memory-resident programs use up to approximately 1.2 Mb
of expanded memory for buffer space. This frees significant conventional
memory and improves ISAM performance, as expanded memory provides more
buffers than could exist in conventional memory. ISAM's use of expanded
memory can affect how other programs, such as QBX, utilize expanded memory.
To limit ISAM's use of expanded memory, use the /Ie option:
 
      /Ie:n option
      Where n is the amount of expanded memory, in kilobytes, to reserve
      for purposes other than ISAM. The default value for n is 0.
      A value of -1 reserves all expanded memory for non-ISAM uses.
      The following command line starts ISAM and reserves 800 K of expanded
      memory for QBX and other uses:
 
          PROISAMD /Ie:800
 
      Use /Ie in conjunction with the /Es option if your program code or
      a loaded Quick library manages expanded memory (see "QBX Use of
      Expanded Memory" below). Other ISAM options are discussed in
      Chapter 10 in the Programmer's Guide, and online in BC Command Line
      and QBX Command Line.
 
QBX Use of Expanded Memory
When you load the QBX environment, expanded memory may already be allocated
to ISAM or other memory-resident programs. Once inside the QBX environment,
you can use the FRE(-3) command to determine how much expanded memory is
available for use by QBX. You can affect QBX's use of expanded memory
with the options described below.
 
      /E:n option
      Where n is the maximum amount of expanded memory, in kilobytes,
      that QBX can use, out of the total amount of available expanded
      memory. A value of 0 disables QBX use of expanded memory, and can
      improve the execution speed of some QBX operations.
 
      If expanded memory is available to QBX, it automatically moves all
      units of program code between 512 bytes and 16K in size, inclusive,
      out of conventional memory into expanded memory. Each procedure
      (function or sub) is a unit of code. The module-level code also
      constitutes a unit of code.
 
      To see how large each procedure is, use the View Subs command
      (press F2). You can determine which units are larger than 16K
      and need to be divided into smaller units.
 
      /Ea option
      Moves all arrays, except arrays of variable-length strings, between
      512 bytes and 16K in size, inclusive, out of conventional memory
      and into expanded memory. Arrays residing in expanded memory cannot
      be passed to mixed-language modules. Do not use /Ea if you pass arrays
      as parameters to mixed-language Quick library routines. Do not use
      /Ea with the /Es option.
 
      When you invoke QBX with /Ea and /L, the specified Quick library
      must have been compiled with the BC /Ah or /D switch. This is
      necessary because /Ah and /D cause run-time calls instead of
      inline code generation for array references.
 
      The following QBX command line allows QBX to use 500K of expanded
      memory and moves arrays into expanded memory:
 
          QBX /E:500 /Ea
 
      /Es option
      Saves and restores the expanded memory state before and after every
      ISAM statement or QBX call to a Quick library, providing that ISAM
      and QBX are using expanded memory. Enables Quick libraries to use
      expanded memory directly, by using assembly code that calls for
      the expanded-memory interrupt. Use /Es only if your Quick library
      manages expanded memory, since it involves significant overhead.
      Use of the /E:n option with /Es controls QBX's use of expanded memory
      and allows sufficient expanded memory for use by Quick libraries.
      The following QBX command line allows QBX to use 500K of expanded
      memory and enables saving and restoring of the expanded memory state:
 
          QBX /E:500 /Es
 
See Also        Overview of Memory Management