mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 02:31:03 -08:00
191 lines
No EOL
12 KiB
HTML
191 lines
No EOL
12 KiB
HTML
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>17. Allocation frames — Memory Pool System 1.111.0 documentation</title>
|
|
|
|
<link rel="stylesheet" href="../_static/mps.css" type="text/css" />
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: '../',
|
|
VERSION: '1.111.0',
|
|
COLLAPSE_INDEX: false,
|
|
FILE_SUFFIX: '.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
|
<script type="text/javascript" src="../_static/underscore.js"></script>
|
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
|
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
<link rel="top" title="Memory Pool System 1.111.0 documentation" href="../index.html" />
|
|
<link rel="up" title="Reference" href="index.html" />
|
|
<link rel="next" title="18. Debugging pools" href="debugging.html" />
|
|
<link rel="prev" title="16. Allocation patterns" href="pattern.html" />
|
|
</head>
|
|
<body>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="../genindex.html" title="General Index"
|
|
accesskey="I">index</a></li>
|
|
<li class="right" >
|
|
<a href="debugging.html" title="18. Debugging pools"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="pattern.html" title="16. Allocation patterns"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="../index.html">Memory Pool System 1.111.0 documentation</a> »</li>
|
|
<li><a href="index.html" accesskey="U">Reference</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="allocation-frames">
|
|
<span id="topic-frame"></span><span id="index-0"></span><h1>17. Allocation frames<a class="headerlink" href="#allocation-frames" title="Permalink to this headline">¶</a></h1>
|
|
<div class="admonition-deprecated admonition">
|
|
<p class="first admonition-title">Deprecated</p>
|
|
<p>starting with version 1.111.</p>
|
|
<p class="last">If you need special handling of stack-like allocation,
|
|
<a class="reference internal" href="../contact.html#contact"><em>contact us</em></a>.</p>
|
|
</div>
|
|
<p>An allocation frame is a marker that can pushed onto an
|
|
<a class="reference internal" href="../glossary/a.html#term-allocation-point"><em class="xref std std-term">allocation point</em></a> by calling <a class="reference internal" href="#mps_ap_frame_push" title="mps_ap_frame_push"><tt class="xref c c-func docutils literal"><span class="pre">mps_ap_frame_push()</span></tt></a>, and
|
|
then popped by calling <a class="reference internal" href="#mps_ap_frame_pop" title="mps_ap_frame_pop"><tt class="xref c c-func docutils literal"><span class="pre">mps_ap_frame_pop()</span></tt></a> to indicate that all
|
|
blocks allocated on the allocation point are <a class="reference internal" href="../glossary/d.html#term-dead"><em class="xref std std-term">dead</em></a> (in the case
|
|
of <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual</em></a> pools), or very likely
|
|
dead (in the case of <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic</em></a>
|
|
pools).</p>
|
|
<p>Allocation frames can be used by the <a class="reference internal" href="../glossary/c.html#term-client-program"><em class="xref std std-term">client program</em></a> to
|
|
efficiently implement stack-like patterns of allocation.</p>
|
|
<div class="admonition-note admonition">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">All <a class="reference internal" href="../glossary/p.html#term-pool-class"><em class="xref std std-term">pool classes</em></a> that support <a class="reference internal" href="../glossary/a.html#term-allocation-point"><em class="xref std std-term">allocation points</em></a>
|
|
also support pushing and popping of allocation frames, but only
|
|
the <a class="reference internal" href="../pool/snc.html#pool-snc"><em>SNC (Stack No Checking)</em></a> pool class actually uses these frames to
|
|
manage its blocks.</p>
|
|
</div>
|
|
<dl class="type">
|
|
<dt id="mps_frame_t">
|
|
<tt class="descname">mps_frame_t</tt><a class="headerlink" href="#mps_frame_t" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>The type of <a class="reference internal" href="../glossary/a.html#term-allocation-frame"><em class="xref std std-term">allocation frames</em></a>.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="mps_ap_frame_push">
|
|
<a class="reference internal" href="error.html#mps_res_t" title="mps_res_t">mps_res_t</a> <tt class="descname">mps_ap_frame_push</tt><big>(</big><a class="reference internal" href="#mps_frame_t" title="mps_frame_t">mps_frame_t</a><em> *frame_o</em>, <a class="reference internal" href="allocation.html#mps_ap_t" title="mps_ap_t">mps_ap_t</a><em> ap</em><big>)</big><a class="headerlink" href="#mps_ap_frame_push" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Declare a new <a class="reference internal" href="../glossary/a.html#term-allocation-frame"><em class="xref std std-term">allocation frame</em></a> and push it onto an
|
|
<a class="reference internal" href="../glossary/a.html#term-allocation-point"><em class="xref std std-term">allocation point’s</em></a> frame stack.</p>
|
|
<p><tt class="docutils literal"><span class="pre">frame_o</span></tt> points to a location that will hold the new frame if the
|
|
function is successful.</p>
|
|
<p><tt class="docutils literal"><span class="pre">ap</span></tt> is the allocation point in which the new frame is declared.</p>
|
|
<p>Returns a <a class="reference internal" href="../glossary/r.html#term-result-code"><em class="xref std std-term">result code</em></a>. The creation of new frames (which
|
|
is implicit in the action of this function) can consume resources,
|
|
so this function can fail because there are insufficient
|
|
resources, or if the correct protocol is not followed by the
|
|
<a class="reference internal" href="../glossary/c.html#term-client-program"><em class="xref std std-term">client program</em></a>.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="function">
|
|
<dt id="mps_ap_frame_pop">
|
|
<a class="reference internal" href="error.html#mps_res_t" title="mps_res_t">mps_res_t</a> <tt class="descname">mps_ap_frame_pop</tt><big>(</big><a class="reference internal" href="allocation.html#mps_ap_t" title="mps_ap_t">mps_ap_t</a><em> ap</em>, <a class="reference internal" href="#mps_frame_t" title="mps_frame_t">mps_frame_t</a><em> frame</em><big>)</big><a class="headerlink" href="#mps_ap_frame_pop" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Declare that a set of <a class="reference internal" href="../glossary/b.html#term-block"><em class="xref std std-term">blocks</em></a> in a
|
|
<a class="reference internal" href="../glossary/a.html#term-allocation-frame"><em class="xref std std-term">allocation frame</em></a> are <a class="reference internal" href="../glossary/d.html#term-dead"><em class="xref std std-term">dead</em></a> or likely to be dead,
|
|
and pop the frame from the <a class="reference internal" href="../glossary/a.html#term-allocation-point"><em class="xref std std-term">allocation point’s</em></a> frame stack.</p>
|
|
<p><tt class="docutils literal"><span class="pre">ap</span></tt> is the allocation point in which <tt class="docutils literal"><span class="pre">frame</span></tt> was pushed.</p>
|
|
<p><tt class="docutils literal"><span class="pre">frame</span></tt> is the allocation frame whose blocks are likely to be
|
|
dead.</p>
|
|
<p>Returns a <a class="reference internal" href="../glossary/r.html#term-result-code"><em class="xref std std-term">result code</em></a>.</p>
|
|
<p>This function pops <tt class="docutils literal"><span class="pre">frame</span></tt>, making its parent the current
|
|
frame. Popping invalidates <tt class="docutils literal"><span class="pre">frame</span></tt> and all frames pushed since
|
|
<tt class="docutils literal"><span class="pre">frame</span></tt>. Popping <tt class="docutils literal"><span class="pre">frame</span></tt> also makes a declaration about the set of
|
|
blocks which were allocated in <tt class="docutils literal"><span class="pre">frame</span></tt> and all frames which were
|
|
pushed since <tt class="docutils literal"><span class="pre">frame</span></tt>.</p>
|
|
<p>The interpretation of this declaration depends on the <a class="reference internal" href="../glossary/p.html#term-pool"><em class="xref std std-term">pool</em></a>
|
|
that the allocation point belongs to. Typically, <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual</em></a> pool classes use this declaration to
|
|
mean that the blocks are dead and their space can be reclaimed
|
|
immediately, whereas <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic</em></a> pool classes use this declaration to mean that the
|
|
blocks are likely to be mostly dead, and may use this declaration
|
|
to alter its collection decisions. See the documentation for the
|
|
pool class.</p>
|
|
<p>In general a frame other than the current frame can be popped (all
|
|
frames pushed more recently will be invalidated as well, as
|
|
described above), but a pool class may impose the restriction that
|
|
only the current frame may be popped. This restriction means that
|
|
every push must have a corresponding pop. See the documentation
|
|
for the pool class.</p>
|
|
<p>It is illegal to pop frames out of order (so the sequence “A =
|
|
push; B = push; pop A; pop B” is illegal) or to pop the same frame
|
|
twice (so the sequence “A = push, pop A, pop A” is illegal).</p>
|
|
</dd></dl>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sphinxsidebar">
|
|
<div class="sphinxsidebarwrapper">
|
|
<p class="logo"><a href="../index.html">
|
|
<img class="logo" src="../_static/logo.png" alt="Logo"/>
|
|
</a></p>
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="pattern.html"
|
|
title="previous chapter">16. Allocation patterns</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="debugging.html"
|
|
title="next chapter">18. Debugging pools</a></p><h4>Downloads</h4>
|
|
|
|
<p class="topless">
|
|
<a href="http://www.ravenbrook.com/project/mps/release/1.111.0/">MPS Kit release 1.111.0</a><br>
|
|
<a href="http://www.ravenbrook.com/project/mps/release/">All MPS Kit releases</a>
|
|
</p>
|
|
|
|
<h4>Issues</h4>
|
|
|
|
<p class="topless">
|
|
<a href="http://www.ravenbrook.com/project/mps/issue/?action=list&view=status%3dopen&display=Job:Priority:Title&sort=Priority">Known issues</a><br>
|
|
<a href="http://www.ravenbrook.com/project/mps/issue/?action=fixed&release_fixed=1.111.0">Issues fixed in release 1.111.0</a>
|
|
</p><h4>Contact us</h4>
|
|
|
|
<p class="topless"><a href="mailto:mps-questions@ravenbrook.com">mps-questions@ravenbrook.com</a></p>
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="../genindex.html" title="General Index"
|
|
>index</a></li>
|
|
<li class="right" >
|
|
<a href="debugging.html" title="18. Debugging pools"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="pattern.html" title="16. Allocation patterns"
|
|
>previous</a> |</li>
|
|
<li><a href="../index.html">Memory Pool System 1.111.0 documentation</a> »</li>
|
|
<li><a href="index.html" >Reference</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© <a href="../copyright.html">Copyright</a> 2013, Ravenbrook Limited.
|
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
|
</div>
|
|
</body>
|
|
</html> |