qck.hlp (Table of Contents; Topic list)
Variable Storage and Memory Use
                                                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Variable Storage and Memory Use
 
 ■ Under the MS-DOS operating system, the resident portion of any Visual
   Basic program that is currently running is stored in RAM. This includes
   constants, variables, and any other data needed while the program is
   running.
 
 ■ RAM used by a Visual Basic program is divided into two categories:
 
   RAM Location       Description
   ══════════════     ══════════════════════════════════════════════════════
   Near memory or     Single segment of memory (maximum size 64K), including,
   DGROUP             but not limited to: the near heap, where variables are
                      stored; the stack; and state information about Visual
                      Basic run time
   Far memory         Multiple-segment area of memory outside DGROUP,
                      including but not limited to the far heap, where
                      dynamic arrays, far strings, and properties are stored,
                      along with the Visual Basic program (run-time and
                      generated code)
 
   Note: Each kind of memory contains a "heap" - an area of memory used to
   store dynamic variables.
 
 ■ Visual Basic variable storage and memory use can be summarized as follows:
 
         Visual Basic Data Type                      Memory Location
         ════════════════════════════════════════    ═══════════════════════
         Simple numeric(1) variables                 Near memory or DGROUP
         Fixed-length string data                    Near memory or DGROUP
         Variable-length string data                 Far heap
         Variable-length string descriptors          Near memory or DGROUP
         All numeric(1) array descriptors            Near memory or DGROUP
         Static numeric(1) array data                Near memory or DGROUP
         Static fixed-length string array data       Near memory (compiled)
                                                     Far heap (interpreted)
         Dynamic numeric(1) array data               Far heap
         Dynamic fixed-length string array data      Far heap
         Huge dynamic numeric(1) array data          Far heap
         ───────────────────────────────────────────────────────────────────
         (1) Denotes INTEGER, LONG, SINGLE, DOUBLE, CURRENCY, user-defined,
             and fixed-length strings.
 
 ■ Form and control properties are stored in the far heap, with one far heap
   segment (up to but not exceeding 64K) allocated for each form.
 
 ■ Because the Visual Basic programming environment treats all strings as
   far strings, a program that uses near pointers to string data cannot be
   run or debugged in the programming environment.
 
 See: Variables Summary