• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

2.20 System limits
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • System limits
          • Limits on memory areas
            • The heap
          • Other Limits
          • Reserved Names
    • Packages

2.20.1 Limits on memory areas

SWI-Prolog has a number of memory areas which are only enlarged to a certain limit. The internal data representation limits the local, global and trail stack to 128 MB on 32-bit processors, or more generally to 2 ** bits-per-pointer - 5 bytes. Considering that almost all modern hardware can deal with this amount of memory with ease, the default limits are set to their maximum on 32-bit hardware. The representation limits can easily exceed physical memory on 64-bit hardware. The default limits on 64-bit hardware are double that of 32-bit hardware, which allows for storing the same amount of (Prolog) data.

The limits can be changed from the command line as well as at runtime using set_prolog_stack/2. The table below shows these areas. The first column gives the option name to modify the size of the area. The option character is immediately followed by a number and optionally by a k or m. With k or no unit indicator, the value is interpreted in Kbytes (1024 bytes); with m, the value is interpreted in Mbytes (1024 × 1024 bytes).

The PrologScript facility described in section 2.10.2.1 provides a mechanism for specifying options with the load file. On Windows the default stack sizes are controlled using the Windows registry on the key HKEY_CURRENT_USER\Software\SWI\Prolog using the names localSize, globalSize and trailSize. The value is a DWORD expressing the default stack size in Kbytes. A GUI for modifying these values is provided using the XPCE package. To use this, start the XPCE manual tools using manpce/0 , after which you find Preferences in the File menu.

Considering portability, applications that need to modify the default limits are advised to do so using set_prolog_stack/2.

OptionDefaultArea nameDescription
-L 128Mlocal stackThe local stack is used to store the execution environments of procedure invocations. The space for an environment is reclaimed when it fails, exits without leaving choice points, the alternatives are cut off with the !/0 predicate or no choice points have been created since the invocation and the last subclause is started (last call optimisation).
-G 128Mglobal stackThe global stack is used to store terms created during Prolog's execution. Terms on this stack will be reclaimed by backtracking to a point before the term was created or by garbage collection (provided the term is no longer referenced).
-T 128Mtrail stackThe trail stack is used to store assignments during execution. Entries on this stack remain alive until backtracking before the point of creation or the garbage collector determines they are no longer needed.
Table 2 : Memory areas

2.20.1.1 The heap

With the heap, we refer to the memory area used by malloc() and friends. SWI-Prolog uses the area to store atoms, functors, predicates and their clauses, records and other dynamic data. No limits are imposed on the addresses returned by malloc() and friends.

ClioPatria (version V3.1.1-21-gb8003bb)