Microsoft KB Archive/112820

= PRIVATE Memory Variables and Memory Allocation =

Article ID: 112820

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b for MS-DOS

-



This article was previously published under Q112820



In FoxPro, variables are allocated out of a general pool of FoxPro memory that is defined statically at startup. You can set the size of this pool in FoxPro for Windows by using the MEMLIMIT setting in the CONFIG.FP(W) file. The number of variables and their values will not change the size of the general memory pool defined at startup.

NOTE: In Visual FoxPro, memory is dynamically allocated, and the MEMLIMIT statement is not used.

Despite the common phraseology, "declaring a variable private," the PRIVATE command does not declare anything. It simply hides any higher-level variables of the same name as lower-level variables. The only way to declare or define a PRIVATE variable is to assign it a value.

FoxPro does not generate native code. It is an interpreter and uses the "stack" itself. According to the glossary in the Microsoft C++ version 7.0 "Environment and Tools" manual, the stack is "a dynamically expanding and shrinking area of memory in which data items are stored in consecutive order and removed on a last-in, first-out basis. The stack is most commonly used to store information for function and procedure calls and for local variables." Therefore, variables defined in a FoxPro application cannot be stored "on the stack" and are not static.

