PRIVATE Memory Variables and Memory Allocation

Last reviewed: April 30, 1996
Article ID: Q112820
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, and 2.5b

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.

REFERENCES

MSDN CD 6, Microsoft C++ "Environment and Tools," version 7.0, Glossary (S)


Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.50 2.50a 2.50b
KBCategory: kbenv kbprg
KBSubcategory: FxenvConfigfp


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.