/usr/lib/swi-prolog/doc/Manual/limits.html is in swi-prolog-nox 6.6.6-5.
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 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SWI-Prolog 7.1.16 Reference Manual: Section 2.19</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, dt.multidef
{ color: #fff;
padding: 2px 10px 0px 10px;
margin-bottom: 5px;
font-size: 18px;
vertical-align: middle;
overflow: hidden;
}
dt.pubdef { background-color: #0c3d6e; }
dt.multidef { background-color: #ef9439; }
.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: #fff;
}
div.caption
{ width: 80%;
margin: auto;
text-align:center;
}
/* Footnotes */
.fn {
color: red;
font-size: 70%;
}
.fn-text, .fnp {
position: absolute;
top: auto;
left: 10%;
border: 1px solid #000;
box-shadow: 5px 5px 5px #888;
display: none;
background: #fff;
color: #000;
margin-top: 25px;
padding: 8px 12px;
font-size: larger;
}
sup:hover span.fn-text
{ display: block;
}
/* Lists */
dl.latex
{ margin-top: 1ex;
margin-bottom: 0.5ex;
}
dl.latex dl.latex dd.defbody
{ margin-bottom: 0.5ex;
}
/* PlDoc Tags */
dl.tags
{ font-size: 90%;
margin-left: 5ex;
margin-top: 1ex;
margin-bottom: 0.5ex;
}
dl.tags dt
{ margin-left: 0pt;
font-weight: bold;
}
dl.tags dd
{ margin-left: 3ex;
}
td.param
{ font-style: italic;
font-weight: bold;
}
/* Index */
dt.index-sep
{ font-weight: bold;
font-size: +1;
margin-top: 1ex;
}
/* Tables */
table.center
{ margin: auto;
}
table.latex
{ border-collapse:collapse;
}
table.latex tr
{ vertical-align: text-top;
}
table.latex td,th
{ padding: 2px 1em;
}
table.latex tr.hline td,th
{ border-top: 1px solid black;
}
table.frame-box
{ border: 2px solid black;
}
</style>
</head>
<body style="background:white">
<div class="navigate"><a class="nav" href="index.html"><img src="home.gif" alt="Home"></a>
<a class="nav" href="Contents.html"><img src="index.gif" alt="Contents"></a>
<a class="nav" href="DocIndex.html"><img src="yellow_pages.gif" alt="Index"></a>
<a class="nav" href="summary.html"><img src="info.gif" alt="Summary"></a>
<a class="nav" href="widechars.html"><img src="prev.gif" alt="Previous"></a>
<a class="nav" href="64bits.html"><img src="next.gif" alt="Next"></a>
</div>
<h2 id="sec:limits"><a id="sec:2.19"><span class="sec-nr">2.19</span> <span class="sec-title">System
limits</span></a></h2>
<a id="sec:limits"></a>
<p><h3 id="sec:memlimit"><a id="sec:2.19.1"><span class="sec-nr">2.19.1</span> <span class="sec-title">Limits
on memory areas</span></a></h3>
<a id="sec:memlimit"></a>
<p>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 <var>2 ** bits-per-pointer - 5</var> 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.
<p>The limits can be changed from the command line as well as at runtime
using <a id="idx:setprologstack2:242"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>.
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 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 id="idx:registry:243">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 id="idx:manpce0:244"></a><span class="pred-ext">manpce/0</span>,
after which you find <i>Preferences</i> in the <i>File</i> menu.
<p>Considering portability, applications that need to modify the default
limits are advised to do so using <a id="idx:setprologstack2:245"></a><a class="pred" href="memory.html#set_prolog_stack/2">set_prolog_stack/2</a>.
<p><table class="latex frame-box center">
<tr><td align=center>Option</td><td align=center>Default</td><td>Area
name</td><td>Description </td></tr>
<tr class="hline"><td align=center><strong>-L</strong> </td><td align=center>128M</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><td align=center><strong>-G</strong> </td><td align=center>128M</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><td align=center><strong>-T</strong> </td><td align=center>128M</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 no
longer needed. </td></tr>
<tr><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 Virtual
Machine'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 unlikely. </td></tr>
</table>
<div class="caption"><b>Table 2 : </b>Memory areas</div>
<a id="tab:areas"></a>
<p><h4 id="sec:heap"><a id="sec:2.19.1.1"><span class="sec-nr">2.19.1.1</span> <span class="sec-title">The
heap</span></a></h4>
<a id="sec:heap"></a>
<p><a id="idx:stackmemorymanagement:246"></a><a id="idx:memorylayout:247"></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. No limits are imposed on the
addresses returned by malloc() and friends.
<p><h3 id="sec:morelimits"><a id="sec:2.19.2"><span class="sec-nr">2.19.2</span> <span class="sec-title">Other
Limits</span></a></h3>
<a id="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 id="idx:read1:248"></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 6 to improve error detection and recovery. This can
be switched off with <a id="idx:stylecheck1:249"></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>
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 <a id="idx:read1:250"></a><a class="pred" href="termrw.html#read/1">read/1</a>
and <a id="idx:write1:251"></a><a class="pred" href="termrw.html#write/1">write/1</a>
(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).</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 integers
that appear in clauses, the value (below <a class="flag" href="flags.html#flag:max_tagged_integer">max_tagged_integer</a>
or not) has little impact on the size of the clause.</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>
<p><h3 id="sec:resnames"><a id="sec:2.19.3"><span class="sec-nr">2.19.3</span> <span class="sec-title">Reserved
Names</span></a></h3>
<a id="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.
<p></body></html>
|