General System Limits
This page lists some of the system limits for InterSystems IRIS®.
For limits on identifier names, see Rules and Guidelines for Identifiers.
For additional system-wide limits, see the Configuration Parameter File Reference.
String Length Limit
There is a limit to the length of a string: 3,641,144 characters.
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 result set 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.
Subscript Limits
Local variables, process-private variables, global variables, and lock names can all take subscripts. The following limits apply:
-
There is a maximum length for any subscript. Exceeding the maximum subscript length results in a <SUBSCRIPT> error:
-
For a local array, the maximum length of a subscript is 32767 encoded bytes.
-
For a global array, the maximum length of a subscript is 511 encoded bytes.
Note that in each case, the corresponding number of characters depends on the characters in the subscript and the current locale.
Also, the longest permitted integer is 309 digits; exceeding this limit results in a <MAXNUMBER> error. Therefore, a numeric subscript longer than 309 characters must be specified as a string.
-
The maximum number of subscript levels for a local variable is 255. The maximum number of subscript levels for a global or process-private global is 253. Exceeding the maximum number of subscript levels results in a <SYNTAX> error.
Maximum Length of a Global Reference
The total length of a global reference — that is, the reference to a specific global node or subtree — is limited to 511 encoded characters (which may be fewer than 511 typed characters).
For a conservative determination of the size of a given global reference, use the following guidelines:
-
For the global name: add 1 for each character.
-
For a purely numeric subscript: add 1 for each digit, sign, or decimal point.
-
For a subscript that includes nonnumeric characters: add 3 for each character.
If a subscript is not purely numeric, the actual length of the subscript varies depending on the character set used to encode the string. A multibyte character can take up to 3 bytes.
Note that an ASCII character can take up 1 or 2 bytes. If the collation does case folding, an ASCII character can take 1 byte for the character and 1 byte for the disambiguation byte. If the collation does not perform case folding, an ASCII character takes 1 byte.
-
For each subscript, add 1.
If the sum of these numbers is greater than 511, the reference may be too long.
Because of the way that the limitation is determined, if you must have long subscript or global names, it is helpful to avoid a large number of subscript levels. Conversely, if you are using multiple subscript levels, avoid long global names and long subscripts. Because you may not be able to control the character set(s) you are using, it is useful to keep global names and subscripts shorter.
When there are doubts about particular references, it is useful to create test versions of global references that are of equivalent length to the longest expected global reference (or even a little longer). Data from these tests provides guidance on possible revisions to your naming conventions prior to building your application.
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.
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 %FileOpens in a new tab to %Library.FileOpens in a new tab 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.
lines
Limit: 65535 lines per routine, including comment lines. The limit applies to the size of the INT representation.
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.
parameters
Limit: 255 parameters per subroutine, method, or stored procedure.
procedures
Limit: 32767 per routine.
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
TRY blocks
Limit: 65535 per routine.
variables (private)
Limit (ObjectScript): 32763 per procedure.
variables (public)
Limit (ObjectScript): 65503 per routine or class.
For limits on the lengths of variable names and other identifiers, see Rules and Guidelines for Identifiers.
Other Programming Limits
The following table lists other limits that are relevant when writing code.
{} 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.