home *** CD-ROM | disk | FTP | other *** search
- Q72879 Memory Limits in Visual Basic for Windows
- Microsoft Visual Basic (VBASIC)
- 1.00
- WINDOWS
-
- Summary:
-
- The following memory limitations apply to Microsoft Visual Basic
- programming system version 1.0 for Windows.
-
- Note: This information only applies when running the retail version of
- Microsoft Windows version 3.0. Different memory limitations may apply
- when running Visual Basic under the debug version of Windows provided
- with the Microsoft Windows Software Development Kit (SDK).
-
- More Information:
-
- Each Function or Sub procedure can have up to 64K of pseudo code
- (pcode).
-
- Each Form, Module, and Global Module gets its own data segment (up to
- 64K in size) for the allocation of all static data, strings, and
- simple variables (declared in the General section and Sub and Function
- procedures).
-
- Each array of any data type gets its own data segment, up to 64K in
- size. Arrays larger than 64K cause a "subscript out of range" error.
-
- Huge arrays (arrays larger than 64K) are not directly supported in
- Visual Basic, but you can support huge arrays through the use of a
- Windows dynamic-link library (DLL). A separate article discussing
- support for huge arrays can be found by querying on the following
- words:
-
- huge and array and DLL
-
- The properties for all controls on a form and the properties of
- the form itself go into a single data segment limited to 64K bytes,
- except the following:
-
- The List() property of a List Box
- The List() property of a Combo Box
- The Text property of a Text Box
-
- The List() property gets its own data segment, limited to 64K bytes,
- for each List Box and Combo Box. The Text property of a Text Box has a
- default size limit of 32K, which can be increased to 64K with a call
- to a Windows API function. For more information on how to increase the
- amount of text (from 32K to 64K) that can be entered into a Text Box,
- query on the following words:
-
- windows and api and sendmessage and textlimit
-
- Other memory limits relating to the properties of Controls and Forms
- include:
-
- 1. Each item in the List() property can be up to 1K in size, any item
- over this limit is truncated.
-
- 2. The Caption property of a control can be up to 1K in size, any
- Caption over this limit is truncated.
-
- 3. The Tag property of a control can be up to 32K in size, any Tag
- over 32K causes an "out of memory" error.
-
- There is one name-and-symbol table up to 32K in size per Form, Module,
- or Global Module. A name-and-symbol table contains the actual text of
- Sub function and Sub procedure names, variable names, line numbers,
- line labels, and an additional 4 bytes overhead for each of these
- names and symbols.
-
- If the 32K size limit is exceeded for a name-and-symbol table, an "out
- of memory" error will occur. To solve this, break up the Form or
- Module into multiple Forms or Modules. Note, this cannot be done with
- the Global Module. Only one Global Module is allowed; if you exhaust
- the Global Module's name-and-symbol table, there is no workaround,
- other than to use shorter variable names.
-
- The stack is 16K in size, with just one stack per application. The 16K
- stack size cannot be changed. Note that an "out of stack space" error
- can easily occur when your program uses uncontrolled recursion.
-
- If you run Visual Basic on the debug version of Microsoft
- Windows provided with the Microsoft Windows SDK, all properties
- (including List() and Text properties) go into a single segment, up to
- 64K in size per Form or Module. Other memory management limits may
- also differ under the debug version of Microsoft Windows. The debug
- version of Windows is created by copying a set of dynamic-link library
- (DLL) files from the Windows SDK into your \WINDOWS\SYSTEM
- subdirectory. These special DLLs perform additional error checking,
- including a check for stack overflow.
-
- Keywords: SR# S910530-193
-
- COPYRIGHT Microsoft Corporation, 1991.
- Updated 91/06/27 06:46
-
-