mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 23:10:47 -08:00
219 lines
No EOL
15 KiB
HTML
219 lines
No EOL
15 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>1. Overview of the Memory Pool System — 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="Guide" href="index.html" />
|
|
<link rel="next" title="2. Building the Memory Pool System" href="build.html" />
|
|
<link rel="prev" title="Guide" href="index.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="build.html" title="2. Building the Memory Pool System"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="index.html" title="Guide"
|
|
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">Guide</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="overview-of-the-memory-pool-system">
|
|
<span id="guide-overview"></span><span id="index-0"></span><h1>1. Overview of the Memory Pool System<a class="headerlink" href="#overview-of-the-memory-pool-system" title="Permalink to this headline">¶</a></h1>
|
|
<p>The Memory Pool System is a very general, adaptable, flexible,
|
|
reliable, and efficient memory management system. It permits the
|
|
flexible combination of memory management techniques, supporting
|
|
<a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual</em></a> and <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic memory
|
|
management</em></a>, <a class="reference internal" href="../glossary/i.html#term-inline-allocation-1"><em class="xref std std-term">inline allocation</em></a>,
|
|
<a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a>, <a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weakness</em></a>, and
|
|
multiple concurrent co-operating <a class="reference internal" href="../glossary/i.html#term-incremental-garbage-collection"><em class="xref std std-term">incremental</em></a> <a class="reference internal" href="../glossary/g.html#term-generational-garbage-collection"><em class="xref std std-term">generational</em></a> <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collections</em></a>. It also
|
|
includes a library of <a class="reference internal" href="../glossary/p.html#term-pool-class"><em class="xref std std-term">memory pool classes</em></a>
|
|
implementing specialized memory management policies.</p>
|
|
<p>The MPS has been in development since 1994 and deployed in successful
|
|
commercial products since 1997. Bugs are almost unknown in production.
|
|
It is under continuous development and support by <a class="reference external" href="http://www.ravenbrook.com">Ravenbrook</a>.</p>
|
|
<p>The MPS is distributed under an <a class="reference internal" href="../copyright.html#license"><em>open source license</em></a>. The license is designed to make it possible for you to use
|
|
the MPS in your own projects, provided that you either don’t
|
|
distribute your product, or your product is open source too.</p>
|
|
<p>If the licensing terms aren’t suitable for you (for example, you’re
|
|
developing a closed-source commercial product or a compiler run-time
|
|
system) you can easily license the MPS under different terms from
|
|
Ravenbrook by arrangement. Please <a class="reference internal" href="../contact.html#contact"><em>contact us</em></a> at
|
|
<a class="reference external" href="mailto:mps-questions%40ravenbrook.com">mps-questions<span>@</span>ravenbrook<span>.</span>com</a>
|
|
for details.</p>
|
|
<div class="section" id="supported-target-platforms">
|
|
<span id="index-1"></span><h2>1.1. Supported target platforms<a class="headerlink" href="#supported-target-platforms" title="Permalink to this headline">¶</a></h2>
|
|
<p>The MPS is currently supported for deployment on:</p>
|
|
<ul class="simple">
|
|
<li>Windows XP or later on IA-32 and x86-64, using Microsoft Visual C/C++;</li>
|
|
<li>Linux (Ubuntu 11 and RHEL 6.3 known good, otherwise YMMV) on IA-32 and x86-64, using GCC;</li>
|
|
<li>FreeBSD 7 or later, on IA-32 and x86-64, using GCC;</li>
|
|
<li>OS X 10.4 or later, on IA-32 and x86-64 (single threaded only), using Clang/LLVM.</li>
|
|
</ul>
|
|
<p>The MPS will <em>not</em> work in a multi-threaded 32-bit application on 64-bit
|
|
Windows 7. This is due to a serious fault in Microsoft’s WOW64 emulator
|
|
that we are powerless to correct. It is due to be fixed in Windows 8.
|
|
See <a class="reference external" href="http://zachsaw.blogspot.co.uk/2010/11/wow64-bug-getthreadcontext-may-return.html">WOW64 bug: GetThreadContext() may return stale contents</a>.</p>
|
|
<p>The MPS is highly portable and has run on many other processors and
|
|
operating systems in the past (see <a class="reference internal" href="build.html#guide-build"><em>Building the Memory Pool System</em></a>). Most of the
|
|
MPS is written in very pure ANSI C and compiles without warnings on
|
|
anything.</p>
|
|
</div>
|
|
<div class="section" id="technical-introduction">
|
|
<span id="index-2"></span><h2>1.2. Technical introduction<a class="headerlink" href="#technical-introduction" title="Permalink to this headline">¶</a></h2>
|
|
<p>The figure below gives a simplified picture of a program’s memory from
|
|
the point of view of the Memory Pool System.</p>
|
|
<div class="figure align-center">
|
|
<img alt="Diagram: Overview of the Memory Pool System." src="../_images/overview.svg" /><p class="caption">Overview of the Memory Pool System.</p>
|
|
</div>
|
|
<p>The <strong>arena</strong> is the top-level data structure in the MPS. An
|
|
<a class="reference internal" href="../glossary/a.html#term-arena"><em class="xref std std-term">arena</em></a> is responsible for requesting <a class="reference internal" href="../glossary/m.html#term-memory-3"><em class="xref std std-term">memory<sup>(3)</sup></em></a> from
|
|
the operating system (and returning it), for making memory available
|
|
to <a class="reference internal" href="../glossary/p.html#term-pool"><em class="xref std std-term">pools</em></a>, and for <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>. Multiple
|
|
arenas are supported, but it’s usually best to have only one arena in
|
|
your program, because the MPS can’t collect cyclic structures that
|
|
span multiple arenas. See <a class="reference internal" href="../topic/arena.html#topic-arena"><em>Arenas</em></a>.</p>
|
|
<p>The MPS is designed to co-operate with other memory managers (for
|
|
example <a class="reference internal" href="../glossary/m.html#term-malloc"><em class="xref std std-term">malloc</em></a> and <a class="reference internal" href="../glossary/f.html#term-free-2"><em class="xref std std-term">free<sup>(2)</sup></em></a> in <a class="reference internal" href="../mmref/lang.html#term-c"><em class="xref std std-term">C</em></a>, or operators
|
|
<tt class="docutils literal"><span class="pre">new</span></tt> and <tt class="docutils literal"><span class="pre">delete</span></tt> in <a class="reference internal" href="../mmref/lang.html#term-6"><em class="xref std std-term">C++</em></a>), so you need not move all your
|
|
memory management to the MPS at once, and you can co-operate with
|
|
libraries that use other allocation mechanisms.</p>
|
|
<p>Within the arena you create one or more <strong>pools</strong>. A <a class="reference internal" href="../glossary/p.html#term-pool"><em class="xref std std-term">pool</em></a> is
|
|
responsible for requesting memory from the <a class="reference internal" href="../glossary/a.html#term-arena"><em class="xref std std-term">arena</em></a> and making it
|
|
available to your program. See <a class="reference internal" href="../topic/pool.html#topic-pool"><em>Pools</em></a>.</p>
|
|
<p>Pools belong to <strong>pool classes</strong> that specify policies for how their
|
|
memory is managed. Some pools are <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manually managed</em></a> (you must explicitly return memory to the pool,
|
|
for example by calling <a class="reference internal" href="../topic/allocation.html#mps_free" title="mps_free"><tt class="xref c c-func docutils literal"><span class="pre">mps_free()</span></tt></a>) and others are
|
|
<a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatically managed</em></a> (the
|
|
<a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collector</em></a> reclaims <a class="reference internal" href="../glossary/u.html#term-unreachable"><em class="xref std std-term">unreachable</em></a> blocks). See
|
|
<a class="reference internal" href="../pool/index.html#pool"><em>Pool reference</em></a>.</p>
|
|
<p><a class="reference internal" href="../glossary/f.html#term-formatted-object"><em class="xref std std-term">Formatted</em></a> pools need you to tell them how to
|
|
<strong>scan</strong> for <a class="reference internal" href="../glossary/r.html#term-reference"><em class="xref std std-term">references</em></a> to allocated blocks. See
|
|
<a class="reference internal" href="../topic/scanning.html#topic-scanning"><em>Scanning</em></a>.</p>
|
|
<p>The arena needs you to tell it how to find your <strong>roots</strong>: references to
|
|
allocated blocks that are stored in static data, in memory not managed
|
|
by the MPS, or on your program’s <a class="reference internal" href="../glossary/r.html#term-register"><em class="xref std std-term">registers</em></a> or
|
|
<a class="reference internal" href="../glossary/c.html#term-control-stack"><em class="xref std std-term">control stack</em></a>. See <a class="reference internal" href="../topic/root.html#topic-root"><em>Roots</em></a>.</p>
|
|
<p>The MPS is designed to work with multi-threaded programs. Functions in
|
|
the C interface are thread safe, except in a few documented
|
|
cases. See <a class="reference internal" href="../topic/thread.html#topic-thread"><em>Threads</em></a>. The <a class="reference internal" href="../glossary/a.html#term-allocation-point-protocol"><em class="xref std std-term">allocation point
|
|
protocol</em></a> provides fast lock-free allocation on multiple threads
|
|
simultaneously. See <a class="reference internal" href="../topic/allocation.html#topic-allocation"><em>Allocation</em></a>.</p>
|
|
<p>The garbage collector is <a class="reference internal" href="../glossary/i.html#term-incremental-garbage-collection"><em class="xref std std-term">incremental</em></a>: it proceeds in small steps interleaved with the execution
|
|
of your program, so there are no long waits. See
|
|
<a class="reference internal" href="../topic/collection.html#topic-collection"><em>Garbage collection</em></a>.</p>
|
|
</div>
|
|
<div class="section" id="what-next">
|
|
<h2>1.3. What next?<a class="headerlink" href="#what-next" title="Permalink to this headline">¶</a></h2>
|
|
<p>For a much more detailed technical overview of the MPS, see
|
|
<a class="reference internal" href="../mmref/bib.html#brooksby02"><em>Brooksby (2002)</em></a>.</p>
|
|
<p>If you’re going to try it out, see <a class="reference internal" href="build.html#guide-build"><em>Building the Memory Pool System</em></a>.</p>
|
|
<p>If you have a program in need of memory management, then you’ll want
|
|
to learn how to integrate it with the Memory Pool System. See
|
|
<a class="reference internal" href="lang.html#guide-lang"><em>Garbage collecting a language with the Memory Pool System</em></a>.</p>
|
|
<p>If you want to know more technical details, they appear in the
|
|
<a class="reference internal" href="../topic/index.html#reference"><em>Reference</em></a>.</p>
|
|
</div>
|
|
</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>
|
|
<h3><a href="../index.html">Table Of Contents</a></h3>
|
|
<ul>
|
|
<li><a class="reference internal" href="#">1. Overview of the Memory Pool System</a><ul>
|
|
<li><a class="reference internal" href="#supported-target-platforms">1.1. Supported target platforms</a></li>
|
|
<li><a class="reference internal" href="#technical-introduction">1.2. Technical introduction</a></li>
|
|
<li><a class="reference internal" href="#what-next">1.3. What next?</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="index.html"
|
|
title="previous chapter">Guide</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="build.html"
|
|
title="next chapter">2. Building the Memory Pool System</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="build.html" title="2. Building the Memory Pool System"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="index.html" title="Guide"
|
|
>previous</a> |</li>
|
|
<li><a href="../index.html">Memory Pool System 1.111.0 documentation</a> »</li>
|
|
<li><a href="index.html" >Guide</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> |