/usr/lib/swi-prolog/doc/Manual/limits.html is in swi-prolog-nox 5.10.4-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>SWI-Prolog 5.11.18 Reference Manual: Section 2.18</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=summary HREF="summary.html">
<LINK REL=previous HREF="widechars.html">
<LINK REL=next HREF="64bits.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/
dd.defbody
{ margin-bottom: 1em;
}
dt.pubdef
{ background-color: #c5e1ff;
}
dt.multidef
{ background-color: #c8ffc7;
}
.bib dd
{ margin-bottom: 1em;
}
.bib dt
{ float: left;
margin-right: 1.3ex;
}
pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}
div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}
div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}
div.author
{ text-align: center;
font-style: italic;
}
div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}
div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}
div.toc-h1
{ font-size: 200%;
font-weight: bold;
}
div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}
div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}
div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}
span.sec-nr
{
}
span.sec-title
{
}
span.pred-ext
{ font-weight: bold;
}
span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #202020;
}
/* Footnotes */
sup.fn { color: blue; text-decoration: underline; }
span.fn-text { display: none; }
sup.fn span {display: none;}
sup:hover span
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="summary.html"><IMG SRC="info.gif" BORDER=0 ALT="Summary"></A>
<A class="nav" href="widechars.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="64bits.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>
<H2><A NAME="sec:2.18"><SPAN class="sec-nr">2.18</SPAN> <SPAN class="sec-title">System
limits</SPAN></A></H2>
<A NAME="sec:limits"></A>
<H3><A NAME="sec:2.18.1"><SPAN class="sec-nr">2.18.1</SPAN> <SPAN class="sec-title">Limits
on memory areas</SPAN></A></H3>
<A NAME="sec:memlimit"></A>
<P>SWI-Prolog has a number of memory areas which are only enlarged to a
certain limit. The default sizes for these areas should suffice for most
applications, but big applications may require larger ones. They are
modified by command-line options. 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
<CODE>k</CODE> or <CODE>m</CODE>. With <CODE>k</CODE> or no unit
indicator, the value is interpreted in Kbytes (1024 bytes), with <CODE>m</CODE>,
the value is interpreted in Mbytes (<VAR>1024 × 1024</VAR> bytes).
<P>The local-, global- and trail-stack are limited to 128 Mbytes on 32
bit processors, or more generally to <VAR>2 ** bits-per-long - 5</VAR>
bytes.
<P>The PrologScript facility described in <A class="sec" href="compilation.html">section
2.10.2.1</A> provides a mechanism for specifying options with the
load-file. On Windows the default stack-sizes are controlled using the
Windows <A NAME="idx:registry:257">registry</A> on the key <CODE>HKEY_CURRENT_USER\Software\SWI\Prolog</CODE>
using the names <CODE>localSize</CODE>, <CODE>globalSize</CODE> and <CODE>trailSize</CODE>.
The value is a <CODE>DWORD</CODE> 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 <A NAME="idx:manpce0:258"></A><SPAN class="pred-ext">manpce/0</SPAN>,
after which you find <I>Preferences</I> in the <I>File</I> menu.
<P>
<CENTER>
<TABLE BORDER=2 FRAME=box RULES=groups>
<TR VALIGN=top><TD ALIGN=center>Option</TD><TD ALIGN=center>Default</TD><TD>Area
name</TD><TD>Description </TD></TR>
<TBODY>
<TR VALIGN=top><TD ALIGN=center><STRONG>-L</STRONG> </TD><TD ALIGN=center>16M</TD><TD><B>local
stack</B></TD><TD>The 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). </TD></TR>
<TR VALIGN=top><TD ALIGN=center><STRONG>-G</STRONG> </TD><TD ALIGN=center>32M</TD><TD><B>global
stack</B></TD><TD>The 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). </TD></TR>
<TR VALIGN=top><TD ALIGN=center><STRONG>-T</STRONG> </TD><TD ALIGN=center>32M</TD><TD><B>trail
stack</B></TD><TD>The 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 nor
needed any longer. </TD></TR>
<TR VALIGN=top><TD ALIGN=center><STRONG>-A</STRONG> </TD><TD ALIGN=center>1M</TD><TD><B>argument
stack</B></TD><TD>The argument stack is used to store one of the
intermediate code interpreter's registers. The amount of space needed on
this stack is determined entirely by the depth in which terms are nested
in the clauses that constitute the program. Overflow is most likely when
using long strings in a clause.
<P>In addition, this stack is used by some built-in predicates to handle
cyclic terms. Its default size limit is proportional to the global stack
limit such that it will never overflow. </TD></TR>
</TABLE>
</CENTER>
<TABLE ALIGN=center WIDTH="75%"><TR><TD>
<B>Table 2 : </B>Memory areas</TABLE>
<A NAME="tab:areas"></A>
<H4><A NAME="sec:2.18.1.1"><SPAN class="sec-nr">2.18.1.1</SPAN> <SPAN class="sec-title">The
heap</SPAN></A></H4>
<A NAME="sec:heap"></A>
<P><A NAME="idx:stackmemorymanagement:259"></A><A NAME="idx:memorylayout:260"></A>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. As of SWI-Prolog 2.8.5, no
limits are imposed on the addresses returned by malloc() and friends.
<P>On some machines, the runtime stacks described above are allocated
using `sparse allocation'. Virtual space up to the limit is claimed at
startup and committed and released while the area grows and shrinks. On
Win32 platform this is realised using VirtualAlloc() and friends. On
Unix systems this is realised using mmap().
<H3><A NAME="sec:2.18.2"><SPAN class="sec-nr">2.18.2</SPAN> <SPAN class="sec-title">Other
Limits</SPAN></A></H3>
<A NAME="sec:morelimits"></A>
<DL class="latex">
<DT><B>Clauses</B></DT>
<DD>
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.</DD>
<DT><B>Atoms and Strings</B></DT>
<DD>
SWI-Prolog has no limits on the sizes of atoms and strings. <A NAME="idx:read1:261"></A><A class="pred" href="termrw.html#read/1">read/1</A>
and its derivatives however normally limit the number of newlines in an
atom or string to 5 to improve error detection and recovery. This can be
switched off with <A NAME="idx:stylecheck1:262"></A><A class="pred" href="debugger.html#style_check/1">style_check/1</A>.
<P>The number of atoms is limited to 16777216 (16M) on 32-bit machines.
On 64-bit machines this is virtually unlimited. See also <A class="sec" href="foreigninclude.html">section
9.4.2.1</A>.</DD>
<DT><B>Memory areas</B></DT>
<DD>
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.</DD>
<DT><B>Nesting of terms</B></DT>
<DD>
Many build-in predicates process nested terms using recursive C
functions. Too deeply nested terms generally cause a fatal crash. All
these functions avoid recursion on the right-most argument and therefore
terms are not limited on the nesting level of the last argument. This
notably covers long lists. Most functions use a stack for correct
handling of rational trees (cyclic terms). This stack is segmented,
where different segments are allocated using malloc(). Overflow causes a
non-graceful exit.</DD>
<DT><B>Integers</B></DT>
<DD>
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
<CODE>resource_error</CODE>. On systems that lack GMP, integers are
64-bit on 32 as well as 64-bit machines.
<P>Integers up to the value of the <A class="flag" href="flags.html#flag:max_tagged_integer">max_tagged_integer</A>
Prolog flag are represented more efficiently on the stack. For clauses
and records the difference is much smaller.</DD>
<DT><B>Floating point numbers</B></DT>
<DD>
Floating point numbers are represented as C-native double precision
floats, 64 bit IEEE on most machines.
</DD>
</DL>
<H3><A NAME="sec:2.18.3"><SPAN class="sec-nr">2.18.3</SPAN> <SPAN class="sec-title">Reserved
Names</SPAN></A></H3>
<A NAME="sec:resnames"></A>
<P>The boot compiler (see <STRONG>-b</STRONG> option) does not support
the module system. As large parts of the system are written in Prolog
itself we need some way to avoid name clashes with the user's
predicates, database keys, etc. Like Edinburgh C-Prolog <CITE><A class="cite" href="Bibliography.html#CPROLOG:manual">Pereira,
1986</A></CITE> all predicates, database keys, etc. that should be
hidden from the user start with a dollar (<CODE>$</CODE>) sign (see <A NAME="idx:stylecheck1:263"></A><A class="pred" href="debugger.html#style_check/1">style_check/1</A>).
<P></BODY></HTML>
|