2.20.2 Other Limits
- Clauses
- The only limit on clauses is their arity (the number of arguments to the head), which is limited to 1024. Raising this limit is easy and relatively cheap; removing it is harder.
- Atoms and Strings
- SWI-Prolog has no limits on the length of atoms and strings. The number of atoms is limited to 16777216 (16M) on 32-bit machines. On 64-bit machines this is virtually unlimited. See also section 11.4.2.1.
- Memory areas
- On 32-bit hardware, SWI-Prolog data is packed in a 32-bit word, which contains both type and value information. The size of the various memory areas is limited to 128 MB for each of the areas, except for the program heap, which is not limited. On 64-bit hardware there are no meaningful limits.
- Nesting of terms
- Most built-in predicates that process Prolog terms create an explicitly managed stack and perform optimization for processing the last argument of a term. This implies they can process deeply nested terms at constant and low usage of the C stack, and the system raises a resource error if no more stack can be allocated. Currently only read/1 and write/1 (and all variations thereof) still use the C stack and may cause the system to crash in an uncontrolled way (i.e., not mapped to a Prolog exception that can be caught).
- Integers
- On most systems SWI-Prolog is compiled with support for unbounded
integers by means of the GNU GMP library. In practice this means that
integers are bound by the global stack size. Too large integers cause a
resource_error
. On systems that lack GMP, integers are 64-bit on 32- as well as 64-bit machines.Integers up to the value of the max_tagged_integer Prolog flag are represented more efficiently on the stack. For integers that appear in clauses, the value (below max_tagged_integer or not) has little impact on the size of the clause.
- Floating point numbers
- Floating point numbers are represented as C-native double precision floats, 64-bit IEEE on most machines.