Caché Programming Orientation Guide
General System Limits
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

This appendix lists some of the limits that are applicable across all server-side languages. It discusses the following topics:

For limits on identifier names, see Rules and Guidelines for Identifiers.”
For additional system-wide limits, see the Caché Parameter File Reference.
Long String Limit
There is a limit to the length of a value of a variable. If you have long strings enabled in your installation (as they are by default in new installations as of release 2012.2), the limit is 3,641,144 characters. If long strings are not enabled, the limit is 32,767 characters.
To enable or disable long strings, you can use the Management Portal, as described in Enabling Long String Operations,” earlier in this book. (Or, in the Caché parameter file, specify the value of the EnableLongStrings parameter, as described in the EnableLongStrings section of the Caché Parameter File Reference.)
Caché also supports the use of long strings on an optional, per-instance basis. To enable long strings for the current instance, use the EnableLongStrings property of the Config.Miscellaneous class.
When a process actually uses a long string, the memory for the string comes from the operating system’s malloc() buffer, not from the partition memory space for the process. Thus the memory allocated for actual long string values is not subject to the limit set by the Maximum per Process Memory setting on the System Memory and Startup Settings page and does not affect the $STORAGE value for the process.
Important:
It is important to realize that “strings” are not just the result of reading from input/output devices. They can show up in other contexts such as the data in the rows of a resultset returned by an SQL query, by construction of $LISTs with a large number of items, as the output of an XSLT transformation, and many other ways.
If long strings are not enabled, Caché cannot guarantee that an application can take advantage of published limits. These limits all assume that long strings are enabled, unless otherwise noted.
Class Limits
The following limits apply only to classes:
class inheritance depth
Limit: 50. A given class can be subclassed to a depth of 50 but not further.
foreign keys
Limit: 400 per class.
indices
Limit: 400 per class.
methods
Limit: 2000 per class.
parameters
Limit: 1000 per class.
projections
Limit: 200 per class.
properties
Limit: 1000 per class.
queries
Limit: 200 per class.
SQL constraints
Limit: 200 per class.
storage definitions
Limit: 10 per class.
superclasses
Limit: 127 per class.
triggers
Limit: 200 per class.
XData blocks
Limit: 1000 per class.
Class and Routine Limits
The following limits apply to both classes and routines:
class method references
Limit: 32768 unique references per routine or class.
The following is counted as two class method references because the class name is different even though the method name is the same.
 Do ##class(c1).abc(), ##class(c2).abc()
class name references
Limit: 32768 unique references per routine or class.
For example, the following is counted as two class name references:
 Do ##class(c1).abc(), ##class(c2).abc()
Similarly, the following is counted as two class references because the normalization of %File to %Library.File is done at runtime, not at compile time.
 Do ##class(%File).Open(x)
 Do ##class(%Library.File).Open(y)
instance method references
Limit: 32768 per routine or class.
If X and Y are OREFs, the following counts as one instance method reference:
 Do X.abc(), Y.abc()
References to multidimensional properties are counted as instance methods because the compiler cannot distinguish between them. For example, consider the following statement:
 Set var = OREF.xyz(3)
Because the compiler cannot tell whether this statement refers to the method xyz() or to the multi-dimensional property xyz, it counts this as an instance method reference.
literals (ASCII)
Limit: 65535 ASCII literals per routine or class.
An ASCII literal is a quoted string of three or more characters where no character is larger than $CHAR(255).
Note that ASCII literals and Unicode literals are handled separately and have separate limits.
literals (Unicode)
Limit: 65535 Unicode literals per routine or class.
A Unicode literal is a quoted string with at least one character larger than $CHAR(255).
Note that ASCII literals and Unicode literals are handled separately and have separate limits.
property read references
Limit: 32768 per routine or class.
This limit refers to reading the value of a property as in the following example:
 Set X = OREF.prop
property set references
Limit: 32768 per routine or class.
This limit refers to setting the value of a property as in the following example:
 Set OREF.prop = value
routine references
Limit: 65535 per routine or class.
This limit applies to the number of unique references (^routine) in a routine or class.
target references
Limit: 65535 per routine or class.
A target is label^routine (a combination of label and routine).
Any target reference also counts as a routine reference. For example, the following is counted as two routine references and three target references:
 Do Label1^Rtn, Label2^Rtn, Label1^Rtn2
variables (private)
Limit (ObjectScript): 32763 per procedure.
Limit (Caché Basic or MVBasic): 32759 per routine.
variables (public)
Limit (ObjectScript): 65503 per routine or class.
Limit (Caché Basic or MVBasic): 65280 per routine or class.
For limits on the lengths of variable names and other identifiers, see Rules and Guidelines for Identifiers,” earlier in this book.
Other Programming Limits
The following table lists other limits that are relevant when writing code.
%Status object limits
Length limit of error message: Just under 32k characters.
Maximum number of %Status objects that can be combined into a single %Status object: 150.
{} nesting
Limit: 32767 levels.
This is the maximum depth of nesting of any language element that uses curly braces, like IF { FOR { WHILE {...}}}.
characters per line
Limit: 65535 characters per line, if long strings are enabled. Note that in Studio, you cannot edit lines longer than 32767 characters.
global subscript, length
See Maximum Length of a Global Reference in Using Caché Globals.
global reference, length
Limit: 511 encoded characters (which may be fewer than 511 typed characters). The term global reference refers to the name of the global plus all of its subscripts. For a discussion, see Maximum Length of a Global Reference in Using Caché Globals.
lines per routine
Limit: 65535 lines per routine, including comment lines. The limit applies to the size of the INT representation.
numeric value
Limits (for decimal or native format): Approximately 1.0E-128 to 9.22E145. See Numeric Computing in InterSystems Applications,” later in this book.
Limits (for double format): See Numeric Computing in InterSystems Applications,” later in this book.
procedures per routine
Limit: 32767 per routine.
TRY blocks per routine
Limit: 65535 per routine.