/usr/share/doc/racket/reference/garbagecollection.html is in racket-doc 6.7-3.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>16.4 Garbage Collection</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Reference</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewselflink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">16.1 </td><td><a href="weakbox.html" class="tocviewlink" data-pltdoc="x">Weak Boxes</a></td></tr><tr><td align="right">16.2 </td><td><a href="ephemerons.html" class="tocviewlink" data-pltdoc="x">Ephemerons</a></td></tr><tr><td align="right">16.3 </td><td><a href="willexecutor.html" class="tocviewlink" data-pltdoc="x">Wills and Executors</a></td></tr><tr><td align="right">16.4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Garbage Collection</a></td></tr><tr><td align="right">16.5 </td><td><a href="phantom-bytes.html" class="tocviewlink" data-pltdoc="x">Phantom Byte Strings</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">collect-<wbr></wbr>garbage</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._current-memory-use%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">current-<wbr></wbr>memory-<wbr></wbr>use</span></span></a></td></tr><tr><td><a href="#%28def._%28%28quote._~23~25kernel%29._dump-memory-stats%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dump-<wbr></wbr>memory-<wbr></wbr>stats</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="willexecutor.html" title="backward to "16.3 Wills and Executors"" data-pltdoc="x">← prev</a> <a href="memory.html" title="up to "16 Memory Management"" data-pltdoc="x">up</a> <a href="phantom-bytes.html" title="forward to "16.5 Phantom Byte Strings"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""garbagecollection"">16.4<tt> </tt><a name="(part._garbagecollection)"></a>Garbage Collection</h4><p>Set the <a name="(idx._(gentag._375._(lib._scribblings/reference/reference..scrbl)))"></a><span class="stt">PLTDISABLEGC</span> environment variable (to any
value) before Racket starts to disable <a href="eval-model.html#%28tech._garbage._collection%29" class="techoutside" data-pltdoc="x"><span class="techinside">garbage collection</span></a>. Set
the <a name="(idx._(gentag._376._(lib._scribblings/reference/reference..scrbl)))"></a><span class="stt">PLT_INCREMENTAL_GC</span> environment variable
to a value that starts with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">1</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">y</span><span class="hspace"></span></span>, or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">Y</span><span class="hspace"></span></span> to
request incremental mode at all times, but calling
<span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" class="RktValLink" data-pltdoc="x">collect-garbage</a></span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">incremental</span><span class="RktPn">)</span> in a program with a periodic
task is generally a better mechanism for requesting incremental mode.</p><p>In Racket 3m (the main variant of Racket), each garbage collection
logs a message (see <a href="logging.html" data-pltdoc="x">Logging</a>) at the <span class="RktVal">'</span><span class="RktVal">debug</span> level with topic <span class="RktVal">'</span><span class="RktVal">GC</span>.
The data portion of the message is an instance of a <a name="(idx._(gentag._377._(lib._scribblings/reference/reference..scrbl)))"></a><span class="RktSym">gc-info</span>
<a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structure type with 10 fields as follows, but future
versions of Racket may use a <span class="RktSym">gc-info</span> <a href="structures.html#%28tech._prefab%29" class="techoutside" data-pltdoc="x"><span class="techinside">prefab</span></a> structure
with additional fields:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define-struct.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct%29%29" class="RktStxLink" data-pltdoc="x">struct</a></span><span class="hspace"> </span><span class="RktSym">gc-info</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">mode</span><span class="hspace"> </span><span class="RktSym">pre-amount</span><span class="hspace"> </span><span class="RktSym">pre-admin-amount</span><span class="hspace"> </span><span class="RktSym">code-amount</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">post-amount</span><span class="hspace"> </span><span class="RktSym">post-admin-amount</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">start-process-time</span><span class="hspace"> </span><span class="RktSym">end-process-time</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">start-time</span><span class="hspace"> </span><span class="RktSym">end-time</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:prefab</span><span class="RktPn">)</span></td></tr></table></blockquote><ul><li><p>The <span class="RktSym">mode</span> field is a symbol <span class="RktVal">'</span><span class="RktVal">major</span>,
<span class="RktVal">'</span><span class="RktVal">minor</span>, or <span class="RktVal">'</span><span class="RktVal">incremental</span>; <span class="RktVal">'</span><span class="RktVal">major</span>
indicates a collection that inspects all memory,
<span class="RktVal">'</span><span class="RktVal">minor</span> indicates collection that mostly inspects just
recent allocations, and <span class="RktVal">'</span><span class="RktVal">incremental</span> indicates a minor
collection that performs extra work toward the next major
collection.</p><p class="SHistory">Changed in version 6.3.0.7 of package <span class="stt">base</span>: Changed first field from a
boolean (<span class="RktVal">#t</span> for
<span class="RktVal">'</span><span class="RktVal">major</span>, <span class="RktVal">#f</span>
for <span class="RktVal">'</span><span class="RktVal">minor</span>) to a
mode symbol.</p></li><li><p>The <span class="RktSym">pre-amount</span> field reports place-local memory use
(i.e., not counting the memory use of child places) in bytes at
the time that the <a href="eval-model.html#%28tech._garbage._collection%29" class="techoutside" data-pltdoc="x"><span class="techinside">garbage collection</span></a> started. Additional
bytes registered via <span class="RktSym"><a href="phantom-bytes.html#%28def._%28%28quote._~23~25kernel%29._make-phantom-bytes%29%29" class="RktValLink" data-pltdoc="x">make-phantom-bytes</a></span> are included.</p></li><li><p>The <span class="RktSym">pre-admin-amount</span> is a larger number that includes
memory use for the garbage collector’s overhead, such as space
on memory pages that are mapped but not currently used.</p></li><li><p>The <span class="RktSym">code-amount</span> field reports additional memory use
for generated native code (which is the same just before and
after a garbage collection, since it is released via
finalization).</p></li><li><p>The <span class="RktSym">post-amount</span> and <span class="RktSym">post-admin-amount</span> fields
correspond to <span class="RktSym">pre-amount</span> and
<span class="RktSym">pre-admin-amount</span>, but after garbage collection. In
typical configurations, the difference between
<span class="RktSym">post-amount</span> and <span class="RktSym">pre-amount</span> contributes to
<span class="RktSym">post-admin-amount</span>, since reclaimed pages tend to stay
in reserve with the expectation that they’ll be needed again
(but the pages are released if multiple collections pass
without need for the pages).</p></li><li><p>The <span class="RktSym">start-process-time</span> and <span class="RktSym">end-process-time</span>
fields report processor time (in the sense of
<span class="RktSym"><a href="time.html#%28def._%28%28quote._~23~25kernel%29._current-process-milliseconds%29%29" class="RktValLink" data-pltdoc="x">current-process-milliseconds</a></span>) at the start and end of
garbage collection. The difference between the times is the
processor time consumed by collection.</p></li><li><p>The <span class="RktSym">start-time</span> and <span class="RktSym">end-time</span> fields report
real time (in the sense of
<span class="RktSym"><a href="time.html#%28def._%28%28quote._~23~25kernel%29._current-inexact-milliseconds%29%29" class="RktValLink" data-pltdoc="x">current-inexact-milliseconds</a></span>) at the start and end of
garbage collection. The difference between the times is the
real time consumed by garbage collection.</p></li></ul><p>The format of the logged message’s text is subject to change.
Currently, after a prefix that indicates the <a href="places.html#%28tech._place%29" class="techoutside" data-pltdoc="x"><span class="techinside">place</span></a> and
collection mode, the text has the format</p><blockquote><p><span class="sroman">‹<span style="font-style: italic">used</span>›</span><span class="stt">(</span><span class="sroman">‹<span style="font-style: italic">admin</span>›</span><span class="stt">)[</span><span class="sroman">‹<span style="font-style: italic">code</span>›</span><span class="stt">]; free </span><span class="sroman">‹<span style="font-style: italic">reclaimed</span>›</span><span class="stt">(</span><span class="sroman">‹<span style="font-style: italic">adjust</span>›</span><span class="stt">) </span><span class="sroman">‹<span style="font-style: italic">elapsed</span>›</span><span class="stt"> @ </span><span class="sroman">‹<span style="font-style: italic">timestamp</span>›</span></p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="sroman">‹<span style="font-style: italic">used</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Collectable memory in use just prior to garbage collection</p></td></tr><tr><td><p><span class="sroman">‹<span style="font-style: italic">admin</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Additional memory used as to manage collectable memory</p></td></tr><tr><td><p><span class="sroman">‹<span style="font-style: italic">code</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Additional memory used for generated machine code</p></td></tr><tr><td><p><span class="sroman">‹<span style="font-style: italic">reclaimed</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Collectable memory reclaimed by garbage collection</p></td></tr><tr><td><p><span class="sroman">‹<span style="font-style: italic">adjust</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Negation of change to administrative memory minus <span class="sroman">‹<span style="font-style: italic">reclaimed</span>›</span></p></td></tr><tr><td><p><span class="sroman">‹<span style="font-style: italic">elapsed</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Processor time used to perform garbage collection</p></td></tr><tr><td><p><span class="sroman">‹<span style="font-style: italic">timestamp</span>›</span></p></td><td><p><span class="hspace"> </span></p></td><td><p>Processor time since startup of garbage collection’s start</p></td></tr></table></blockquote><p class="SHistory">Changed in version 6.3.0.7 of package <span class="stt">base</span>: Added <span class="stt">PLT_INCREMENTAL_GC</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._collect-garbage))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" class="RktValDef RktValLink" data-pltdoc="x">collect-garbage</a></span></span><span class="hspace"> </span>[<span class="RktVar">request</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">request</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">major</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">minor</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">incremental</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">major</span></td></tr></table></blockquote></div><div class="SIntrapara">Requests an immediate <a href="eval-model.html#%28tech._garbage._collection%29" class="techoutside" data-pltdoc="x"><span class="techinside">garbage collection</span></a> or requests a
garbage-collection mode, depending on <span class="RktVar">request</span>:</div></p><ul><li><p><span class="RktVal">'</span><span class="RktVal">major</span> —<wbr></wbr> Forces a “major” collection, which
inspects all memory. Some effectively unreachable data may
remain uncollected, because the collector cannot prove that it
is unreachable.</p><p>This mode of <span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" class="RktValLink" data-pltdoc="x">collect-garbage</a></span> procedure provides some
control over the timing of collections, but garbage will
obviously be collected even if this procedure is never
called—<wbr></wbr>unless garbage collection is disabled by setting
<span class="stt">PLTDISABLEGC</span>.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">minor</span> —<wbr></wbr> Requests a “minor” collection, which
mostly inspects only recent allocations. If minor collection is
not supported (e.g., when <span class="RktPn">(</span><span class="RktSym"><a href="runtime.html#%28def._%28%28quote._~23~25kernel%29._system-type%29%29" class="RktValLink" data-pltdoc="x">system-type</a></span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">gc</span><span class="RktPn">)</span> returns
<span class="RktVal">'</span><span class="RktVal">cgc</span>) or if the next collection must be a major
collection, no collection is performed. More generally, minor collections
triggered by <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._collect-garbage%29%29" class="RktValLink" data-pltdoc="x">collect-garbage</a></span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">minor</span><span class="RktPn">)</span> do not cause
major collections any sooner than they would occur otherwise.</p></li><li><p><span class="RktVal">'</span><span class="RktVal">incremental</span> —<wbr></wbr> Requests that each minor
collection performs incremental work toward a major collection
(but does not request an immediate minor collection).
This incremental-mode request expires at the next major
collection.</p><p>The intent of incremental mode is to significantly reduce pause
times due to major collections, but incremental mode typically
implies longer minor-collection times and higher memory use.</p><p>If the <span class="stt">PLT_INCREMENTAL_GC</span> environment variable’s value
starts with <span class="RktInBG"><span class="hspace"></span><span class="RktIn">0</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">n</span><span class="hspace"></span></span>, or <span class="RktInBG"><span class="hspace"></span><span class="RktIn">N</span><span class="hspace"></span></span> on
start-up, then incremental-mode requests are ignored.</p></li></ul><p class="SHistory">Changed in version 6.3 of package <span class="stt">base</span>: Added the <span class="RktVar">request</span> argument. Changed in version 6.3.0.2: Added <span class="RktVal">'</span><span class="RktVal">incremental</span> mode.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._current-memory-use))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-memory-use%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-memory-use</a></span></span><span class="hspace"> </span>[<span class="RktVar">mode</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-nonnegative-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-nonnegative-integer?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mode</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">cumulative</span><span class="hspace"> </span><span class="RktSym"><a href="custodians.html#%28def._%28%28quote._~23~25kernel%29._custodian~3f%29%29" class="RktValLink" data-pltdoc="x">custodian?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns information about memory use:</div></p><ul><li><p>If <span class="RktVar">mode</span> is <span class="RktVal">#f</span> (the default), the result is an
estimate of the number of bytes reachable from any custodian.</p></li><li><p>If <span class="RktVar">mode</span> is <span class="RktVal">'</span><span class="RktVal">cumulative</span>, returns an estimate
of the total number of bytes allocated since start up,
including bytes that have since been reclaimed by garbage
collection.</p></li><li><p>If <span class="RktVar">mode</span> is a custodian, returns an estimate of the
number of bytes of memory occupied by reachable data from
<span class="RktVar">mode</span>. This estimate is calculated by the last garbage
collection, and can be 0 if none occurred (or if none occurred
since the given custodian was created). The
<span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._current-memory-use%29%29" class="RktValLink" data-pltdoc="x">current-memory-use</a></span> function does <span style="font-style: italic">not</span> perform
a collection by itself; doing one before the call will
generally decrease the result (or increase it from 0 if no
collections happened yet).</p><p>When Racket is compiled without support for memory accounting,
the estimate is the same as when <span class="RktVar">mode</span> is <span class="RktVal">#f</span>
(i.e., all memory) for any individual custodian. See also
<span class="RktSym"><a href="custodians.html#%28def._%28%28quote._~23~25kernel%29._custodian-memory-accounting-available~3f%29%29" class="RktValLink" data-pltdoc="x">custodian-memory-accounting-available?</a></span>.</p></li></ul><p>See also <span class="RktSym"><a href="runtime.html#%28def._%28%28quote._~23~25kernel%29._vector-set-performance-stats%21%29%29" class="RktValLink" data-pltdoc="x">vector-set-performance-stats!</a></span>.</p><p class="SHistory">Changed in version 6.6.0.3 of package <span class="stt">base</span>: Added <span class="RktVal">'</span><span class="RktVal">cumulative</span> mode.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._dump-memory-stats))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28quote._~23~25kernel%29._dump-memory-stats%29%29" class="RktValDef RktValLink" data-pltdoc="x">dump-memory-stats</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Dumps information about memory usage to the low-level error port
or console.</div></p><p>Various combinations of <span class="RktVar">v</span> arguments can control the
information in a dump. The information that is available depends on
your Racket build; check the end of a dump from a particular build to
see if it offers additional information; otherwise, all <span class="RktVar">v</span>s are
ignored.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="willexecutor.html" title="backward to "16.3 Wills and Executors"" data-pltdoc="x">← prev</a> <a href="memory.html" title="up to "16 Memory Management"" data-pltdoc="x">up</a> <a href="phantom-bytes.html" title="forward to "16.5 Phantom Byte Strings"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|