Microsoft KB Archive/88578

{| = How the Standard and Extended FoxPro Versions Use Memory =
 * width="100%"|

ID: Q88578

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a

SUMMARY
Microsoft FoxPro versions 2.0 and later for MS-DOS can run in either the Standard or Extended version when the computer has an 80386SX or higher processor. However, the two FoxPro versions differ in their memory use.

Standard Version Memory Use
The code for the Standard version is packaged in two pieces: the root portion (in the FOXPRO.EXE file) and a collection of additional code segments (in the FOXPRO.OVL file).

When FoxPro starts up, the root portion is loaded into memory and certain other fixed-sized memory allocations occur. The code and data require about 290K of memory. The collection of code segments requires approximately 1.1 MB of storage on the disk.

After the root portion is loaded into memory, the balance of conventional memory (memory addressed below 640K), any available upper memory blocks (UMBs), and 64K of expanded memory (for systems running according to the Lotus-Intel Microsoft [LIM] version 4.0 Expanded Memory Specification [EMS]) is available to FoxPro as a general-purpose memory pool that can contain any user and system data (for example, BROWSE sessions, code segments, memory variables, windows, and so on) and I/O buffers. Any other EMS memory is used to hold I/O buffers and to store inactive code segments.

FoxPro loads additional code segments on demand. These segments float freely throughout all available memory, in both the general and expanded memory pools. When free memory is required for other purposes, the least- recently-used (LRU) code segment is removed from memory.

Because the root segment is relatively small, the Standard version can run with less than 400K of free memory. However, for most applications, 512K is a more realistic minimum memory size. For all applications, additional memory can greatly improve execution speed.

Extended Version Memory Use
Memory in the First Megabyte of Address Space:

 80K is used to store a portion of the MS-DOS Extender application. If the CONFIG.FP file contains the DOSMEM=K statement, the specified amount of memory is retained for later use when free memory is remapped. This memory then becomes available as extended memory. A buffer is allocated from the remaining free memory. The maximum size of the buffer is 60K, depending on the amount of free memory available. When the RUN command is executed, FoxPro reallocates this buffer to make more memory available to the program specified in the RUN command. NOTE: If the amount of space reserved in the DOSMEM statement is too great, degraded I/O performance can result because this buffer is too small or eliminated entirely. If the CONFIG.FP file contains the DOSMEM statement, the balance of conventional memory (addressed in the first 640K) is remapped and becomes available as extended memory. FoxPro does not use any UMBs.

Extended Memory:
 * All the code in the Extended version and the remainder of the MS-DOS Extender application is loaded into extended memory and certain fixed memory allocations are made. These allocations require approximately 1,450K of extended memory.
 * The balance of extended memory is available for general use.

Because the Extended version of FoxPro is a true 32-bit product, some internal data structures (for example, memory variables, windows, and so on) require slightly more memory in the Extended version than in the Standard version. Therefore, a program generally requires somewhat more memory to run in the Extended version than in the Standard version.

Reasons to Use Each Version
In the Standard version, FoxPro code segments are loaded into memory on demand; they need not be in memory at all times. Also, the Standard version does not reserve space for the MS-DOS Extender application. Therefore, for a given amount of memory installed in a machine, about 1.1 MB more memory is potentially available to store I/O buffers when the Standard version is running than when the Extended version is running. However, not all the additional memory may actually be available to store buffers. When a large application is running, much of the memory may be used to store code segments or other data.

Because the speed of an I/O operation can be very sensitive to the amount of free memory, an I/O-intensive program might greatly benefit from the additional memory provided by the Standard version. Obviously, an extra megabyte of buffer memory will significantly affect performance on a machine with only 3 MB of memory installed. For this reason, the Standard version will most likely run an I/O benchmark faster than the Extended version on a machine with limited memory. However, the marginal advantage provided by this additional buffer of memory becomes much smaller as additional memory is installed.

However, if an application consists primarily of data entry and the maximum interface response is required, even when many new features are used, the Extended version may be a better choice, even on a machine with a limited amount of memory. Because the Extended version loads all FoxPro code into memory, segment-loading overhead is eliminated.

In the Extended version, the size of the programs, the number of windows, string storage space, the number of memory variables, and so on, are limited only by the amount of memory on the machine. In the Standard version, a maximum of 460K of total free memory is available for general purposes. Therefore, a very large or complex application, particularly one that heavily uses the SQL interface, mandates use of the Extended version.

On a machine with 3 MB or less of installed memory, it is possible to develop programs that run in the Standard version but that do not run in the Extended version because the internal data structures are larger. However, this situation is quite rare.

By default, demand paging is activated when the Extended version is running on any machine that has less than 2.5 MB of total memory. The overhead imposed by demand paging becomes larger as free memory becomes smaller. Less memory requires more swapping. NOTE: To disable the Extended version's demand paging feature, add the DOSMEM=ON statement to the CONFIG.FP file. Keep in mind that when demand paging is disabled, FoxPro is unable to run programs or load code (API) libraries.

If a machine has 4 MB or more of total memory, using the Extended version is recommended. However, no matter how much memory exists, the Standard version may have more memory available to hold buffers than the Extended version does. For this reason, it is sometimes possible to develop an I/O benchmark in which the Standard version runs faster.

If a machine has between 3 and 4 MB of total memory, the Extended version is usually better.

If the machine has between 2 and 3 MB of total memory, the version choice depends largely on the specific application.

If the machine has 2 MB or less of total memory, the Standard version is recommended.

Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbenv kbprg KBSubcategory:
 * }