Microsoft KB Archive/87847

{| = FoxPro RUN Command Memory Allocation Options =
 * width="100%"|

ID: Q87847

The information in this article applies to:


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

SUMMARY
The RUN command has several memory allocation options that can be used to optimize program swapping. These options are described below.

MORE INFORMATION
The RUN command, which allows the user to run external MS-DOS commands and programs, has the following syntax:

RUN [/n [K]] 

-or-

! [/n [K]]  The optional /n switch specifies the memory-allocation requirements in kilobytes (K). After the command or program completes execution, control returns to Microsoft FoxPro.

RUN Command with No Command Options
When the RUN command is not given any command options, FoxPro attempts to execute the external program in the memory currently available. If adequate memory is not available, executing the external program fails, and control is returned to FoxPro.

To guarantee that an adequate amount of memory is available, specify the required amount of memory in the appropriate RUN command option.

RUN Command with /n
When the RUN command has the /n or /nK switch, where &quot;n&quot; is a number greater than zero, the specified amount of memory must be available to execute the specified command or program. Prior to invoking the RUN command, FoxPro determines how much memory is available. If the memory currently available exceeds the amount specified in the RUN command option, FoxPro invokes the specified command or program immediately.

However, if available memory is less than the specified amount, the FoxPro programming swapping utility, FOXSWAP, frees the required additional memory by swapping portions of memory to disk. When the external program completes execution, FOXSWAP restores the previous memory contents.

RUN Command with /0
When the RUN command specifies the /0 switch, FOXSWAP swaps the entire contents of memory to disk. In some cases, 400K or more of memory is swapped to disk.

Performance Gains
Judiciously using RUN command options can aid performance by optimizing the amount of memory swapped to disk. In particular, unnecessary use of the /0 switch compromises performance.

For example, if an external text editor requires a minimum of 128K plus file space, use the following RUN command:

RUN /160 ne The /160 option ensures that adequate memory is available for the text editor without swapping the entire contents of memory to disk. Additional reference words: FoxDos 2.00 2.50 2.50a 2.x KBCategory: kbprg KBSubcategory:
 * }