Microsoft Knowledge Base

Microsoft Test Code and Data Capacities

Last reviewed: March 3, 1995
Article ID: Q126674
The information in this article applies to:

- Microsoft Test for Windows, versions 2.0 and 3.0 (16-bit version only)

SUMMARY

This article the capacities of data and code in a Microsoft Test script.

MORE INFORMATION

Data Capacities

You can have up to 64K for static variables and quoted literal strings. These are variables that are declared at the main code level, inside STATIC subs and functions, or declared statically inside non-static subs and functions (using the STATIC keyword). For static variable-length strings, only the 6-byte string descriptor is stored in static variable space. If you declare too many static variables, you will receive a "Data segment exceeded" parse-time error message.

You can have up to 64K for stack space. The stack is used for "call frames" (information used by TestBasic for maintenance of calls to user-defined subs and functions) and for dynamic variable allocations. Variables declared inside non-static subs and functions are allocated on the stack; thus, for each entry to the sub or function a new "copy" of each variable is made. Temporary variables used for expressions inside subs and functions (static OR non-static) are also allocated on the stack. If you run out of stack space, either by declaring too many local variables or by calling a function recursively too many times, you will receive an "Out of stack space" runtime error. You can use the STACK function to determine how much available stack space you have remaining.

The amount of string space you have is only limited by your system's memory capacity. "String space" refers to memory used by variable-length strings only -- fixed-length strings are allocated either in static memory or on the stack. Each individual string has a maximum size of 63,400 characters (bytes), but you can create as many of these strings as your system can handle. Dynamic strings (declared in non-static subs and functions) are destroyed when you exit the sub or function automatically, so they do not waste memory after the call. If you exceed your system's memory capacity with string operations, or if you create a string that is longer than 63,400 characters, you will receive an "Out of string space" error message.

The amount of array memory available is only limited by your system's memory capacity. All arrays in TestBasic are dynamically allocated at runtime out of the system's global memory heap. Each array can potentially be of any size, even greater than 64K (see "Huge Arrays"). If you run out of system memory creating an array, you will receive an "Out of memory" runtime error.

You can dynamically allocate memory up to your system's memory capacity. This refers to memory allocated with the ALLOCATE statement. Each block of memory allocated with the ALLOCATE statement can be up to 65,532 bytes in size. However, you can allocate as many of these as your system can handle. If you run out of system memory allocating memory with the ALLOCATE statement, you will receive an "Out of memory" runtime error. If you attempt to ALLOCATE a block of memory bigger than 65,532 bytes, you will receive an "Invalid memory allocation size" runtime error.

Code Capacities

You can have only one segment (64k max) for the p-code generated by the main level of the script and one segment each for the p-code of each SUB or FUNCTION. So you can split your program into functions or SUBs instead of placing all the code at the main level of the script.

REFERENCES

Microsoft Test 3.0 User's Guide, "The Test Script Data Capacity" section of Chapter 6, Advanced Programming Techniques, page 173.

Microsoft Test 2.0 User's Guide, "The Test Script Data Capacity" section of Chapter 6, Advanced Programming Techniques, pages 156-157.


Additional reference words: keytrap 2.00 3.00 limitations
KBCategory: kbprg
KBSubcategory:


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: March 3, 1995
©1997 Microsoft Corporation. All rights reserved. Legal Notices.