mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 11:50:51 -08:00
719 lines
No EOL
58 KiB
HTML
719 lines
No EOL
58 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>4. Memory management in various languages — 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="Introduction to memory management" href="index.html" />
|
||
<link rel="next" title="5. Frequently Asked Questions" href="faq.html" />
|
||
<link rel="prev" title="3. Recycling techniques" href="recycle.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="faq.html" title="5. Frequently Asked Questions"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="recycle.html" title="3. Recycling techniques"
|
||
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">Introduction to memory management</a> »</li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body">
|
||
|
||
<div class="section" id="memory-management-in-various-languages">
|
||
<span id="lang"></span><h1>4. Memory management in various languages<a class="headerlink" href="#memory-management-in-various-languages" title="Permalink to this headline">¶</a></h1>
|
||
<dl class="glossary docutils">
|
||
<dt id="term-algol">ALGOL</dt>
|
||
<dd><p class="first">ALGOL, designed in 1958 for scientific computing, was the
|
||
first block-structured language. It spawned a whole family of
|
||
languages, and inspired many more, including <a class="reference internal" href="#term-scheme"><em class="xref std std-term">Scheme</em></a>,
|
||
<a class="reference internal" href="#term-simula"><em class="xref std std-term">Simula</em></a> and <a class="reference internal" href="#term-pascal"><em class="xref std std-term">Pascal</em></a>.</p>
|
||
<p>The block structure of ALGOL 60 induced a <a class="reference internal" href="../glossary/s.html#term-stack-allocation"><em class="xref std std-term">stack
|
||
allocation</em></a> discipline. It had limited dynamic arrays, but no
|
||
general <a class="reference internal" href="../glossary/h.html#term-heap-allocation"><em class="xref std std-term">heap allocation</em></a>. The substantially redesigned
|
||
ALGOL 68 had both heap and stack allocation. It also had
|
||
something like the modern <a class="reference internal" href="../glossary/p.html#term-pointer"><em class="xref std std-term">pointer</em></a> type, and required
|
||
<a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a> for the heap. The new language was
|
||
complex and difficult to implement, and it was never as
|
||
successful as its predecessor.</p>
|
||
<div class="admonition-related-publication last admonition">
|
||
<p class="first admonition-title">Related publication</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#bl72"><em>Branquart & Lewi (1972)</em></a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-basic">BASIC</dt>
|
||
<dd><p class="first">BASIC is a simple and easily-learned programming language
|
||
created by T. E. Kurtz and J. G. Kemeny in 1963–4. The
|
||
motivation was to make computers easily accessible to
|
||
undergraduate students in all disciplines.</p>
|
||
<p>Most BASICs had quite powerful string handling operations that
|
||
required a simple <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collector</em></a>. In many
|
||
implementations, the garbage collector could be forced to run
|
||
by running the mysterious expression <tt class="docutils literal"><span class="pre">FRE("")</span></tt>.</p>
|
||
<p class="last">BASIC is now old-fashioned, but survives as a scripting
|
||
language, in particular in Visual BASIC, which is an
|
||
application development environment with a BASIC-like
|
||
scripting language. These descendants invariably have
|
||
automatic memory management as well.</p>
|
||
</dd>
|
||
<dt id="term-c">C</dt>
|
||
<dd><p class="first">C is a systems programming language sometimes described as “a
|
||
portable assembler” because it was intended to be sufficiently
|
||
low-level to allow performance comparable to assembler or
|
||
machine code, but sufficiently high-level to allow programs to
|
||
be reused on other platforms with little or no modification.</p>
|
||
<p><a class="reference internal" href="../glossary/m.html#term-memory-management"><em class="xref std std-term">Memory management</em></a> is typically manual (the standard
|
||
library functions for <a class="reference internal" href="../glossary/m.html#term-memory-2"><em class="xref std std-term">memory<sup>(2)</sup></em></a> management in C,
|
||
<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>, have become almost
|
||
synonymous with <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual memory management</em></a>), although
|
||
with the Boehm-Weiser <a class="reference internal" href="../glossary/c.html#term-collector-1"><em class="xref std std-term">collector<sup>(1)</sup></em></a>, it is now
|
||
possible to use <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>.</p>
|
||
<p>The language is notorious for fostering memory management
|
||
bugs, including:</p>
|
||
<ol class="arabic simple">
|
||
<li>Accessing arrays with indexes that are out of bounds;</li>
|
||
<li>Using <a class="reference internal" href="../glossary/s.html#term-stack-allocation"><em class="xref std std-term">stack-allocated</em></a> structures
|
||
beyond their <a class="reference internal" href="../glossary/l.html#term-lifetime"><em class="xref std std-term">lifetimes</em></a> (see <a class="reference internal" href="../glossary/u.html#term-use-after-free"><em class="xref std std-term">use after
|
||
free</em></a>);</li>
|
||
<li>Using <a class="reference internal" href="../glossary/h.html#term-heap-allocation"><em class="xref std std-term">heap-allocated</em></a> structures
|
||
after <a class="reference internal" href="../glossary/f.html#term-free-1"><em class="xref std std-term">freeing</em></a> them (see <a class="reference internal" href="../glossary/u.html#term-use-after-free"><em class="xref std std-term">use after
|
||
free</em></a>);</li>
|
||
<li>Neglecting to free heap-allocated objects when they are no
|
||
longer required (see <a class="reference internal" href="../glossary/m.html#term-memory-leak"><em class="xref std std-term">memory leak</em></a>);</li>
|
||
<li>Failing to allocate memory for a <a class="reference internal" href="../glossary/p.html#term-pointer"><em class="xref std std-term">pointer</em></a> before using it;</li>
|
||
<li>Allocating insufficient memory for the intended contents;</li>
|
||
<li>Loading from allocated memory before storing into it;</li>
|
||
<li>Dereferencing non-pointers as if they were pointers.</li>
|
||
</ol>
|
||
<div class="admonition-see-also admonition seealso">
|
||
<p class="first admonition-title">See also</p>
|
||
<p class="last"><a class="reference internal" href="../glossary/a.html#term-automatic-storage-duration"><em class="xref std std-term">automatic storage duration</em></a>, <a class="reference internal" href="../glossary/s.html#term-static-storage-duration"><em class="xref std std-term">static storage duration</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-publication admonition">
|
||
<p class="first admonition-title">Related publications</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#c1990"><em>ISO/IEC 9899:1990</em></a>, <a class="reference internal" href="bib.html#c1999"><em>ISO/IEC 9899:1999</em></a>, <a class="reference internal" href="bib.html#bw88"><em>Boehm & Weiser (1988)</em></a>, <a class="reference internal" href="bib.html#daconta93"><em>Daconta (1993)</em></a>, <a class="reference internal" href="bib.html#zorn93"><em>Zorn (1993)</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">Boehm-Weiser collector</a>,
|
||
<a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg14/">C standardization</a>,
|
||
<a class="reference external" href="http://c-faq.com/">comp.lang.c Frequently Asked Questions</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-cobol">COBOL</dt>
|
||
<dd><p class="first">COBOL was designed by the CODASYL committee in 1959–60 to be a
|
||
business programming language, and has been extended many
|
||
times since. A 1997 Gartner Group report estimated that 80% of
|
||
computer software (by count of source lines) was written in
|
||
COBOL.</p>
|
||
<p>Prior to 2002, COBOL had no <a class="reference internal" href="../glossary/h.html#term-heap-allocation"><em class="xref std std-term">heap allocation</em></a>, and did
|
||
well in its application domain without it. COBOL 2002 has
|
||
<a class="reference internal" href="../glossary/p.html#term-pointer"><em class="xref std std-term">pointers</em></a> and heap allocation through <tt class="docutils literal"><span class="pre">ALLOCATE</span></tt> and
|
||
<tt class="docutils literal"><span class="pre">FREE</span></tt>, mainly in order to be able to use C-style
|
||
interfaces. It also supports a high level of abstraction
|
||
through object-oriented programming and <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage
|
||
collection</em></a> (including <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a>).</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.cobolstandard.info/wg4/wg4.html">COBOL standardization</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-common-lisp">Common Lisp</dt>
|
||
<dd><p class="first">Common Lisp is the major dialect of the <a class="reference internal" href="#term-lisp"><em class="xref std std-term">Lisp</em></a> family.
|
||
In addition to the usual Lisp features, it has an advanced
|
||
object system, data types from hash tables to complex numbers,
|
||
and a rich standard library.</p>
|
||
<p>Common Lisp is a <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage-collected</em></a> language, and modern implementations, such as
|
||
<a class="reference external" href="http://www.lispworks.com/">LispWorks</a> and <a class="reference external" href="http://www.franz.com/products/allegro-common-lisp/">Allegro CL</a>,
|
||
include advanced features, such as <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a> and
|
||
<a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weakness</em></a>.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.lispworks.com/documentation/HyperSpec/Front/">Common Lisp HyperSpec</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-5">C#</dt>
|
||
<dd><p class="first">C# is a strongly typed object-oriented language created at
|
||
Microsoft in 1999–2000. It is designed to run on the Common
|
||
Language Runtime, the virtual machine from the .NET Framework.
|
||
It also runs on the open source Mono runtime.</p>
|
||
<p>Memory is <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatically managed</em></a>: memory is allocated when an object is created,
|
||
and reclaimed at some point after the object becomes
|
||
<a class="reference internal" href="../glossary/u.html#term-unreachable"><em class="xref std std-term">unreachable</em></a>.</p>
|
||
<p>The language supports <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a> (classes may have
|
||
<em>destructor functions</em>, which are run just before the object
|
||
is reclaimed by the memory manager), and <a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weak
|
||
references<sup>(1)</sup></em></a> (via the <tt class="docutils literal"><span class="pre">WeakReference</span></tt> class).</p>
|
||
<p>The <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collector</em></a> in the .NET Framework is
|
||
configurable to run in soft real time, or in batch mode.</p>
|
||
<p>The Mono runtime comes with two collectors: the Boehm–Weiser
|
||
<a class="reference internal" href="../glossary/c.html#term-conservative-garbage-collection"><em class="xref std std-term">conservative collector</em></a>, and 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/c.html#term-copying-garbage-collection"><em class="xref std std-term">copying collector</em></a>.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://msdn.microsoft.com/en-us/library/aa691138.aspx">Automatic memory management in C#</a>,
|
||
<a class="reference external" href="http://msdn.microsoft.com/en-us/library/system.weakreference.aspx">WeakReference Class</a>,
|
||
<a class="reference external" href="http://msdn.microsoft.com/en-us/library/hh156531.aspx">Memory Management and Garbage Collection in the .NET Framework</a>,
|
||
<a class="reference external" href="http://www.mono-project.com/Main_Page">Mono project</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-6">C++</dt>
|
||
<dd><p class="first">C++ is a (weakly) object-oriented language, extending the
|
||
systems programming language <a class="reference internal" href="#term-c"><em class="xref std std-term">C</em></a> with a
|
||
multiple-inheritance class mechanism and simple method
|
||
dispatch.</p>
|
||
<p>The standard library functions for <a class="reference internal" href="../glossary/m.html#term-memory-2"><em class="xref std std-term">memory<sup>(2)</sup></em></a>
|
||
management in C++ are <tt class="docutils literal"><span class="pre">new</span></tt> and <tt class="docutils literal"><span class="pre">delete</span></tt>. The higher
|
||
abstraction level of C++ makes the bookkeeping required for
|
||
<a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual memory management</em></a> even harder. Although the
|
||
standard library provides only manual memory management, with
|
||
the Boehm-Weiser <a class="reference internal" href="../glossary/c.html#term-collector-1"><em class="xref std std-term">collector<sup>(1)</sup></em></a>, it is now possible to
|
||
use <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>. <a class="reference internal" href="../glossary/s.html#term-smart-pointer"><em class="xref std std-term">Smart pointers</em></a> are
|
||
another popular solution.</p>
|
||
<p>The language is notorious for fostering memory management
|
||
bugs, including:</p>
|
||
<ol class="arabic simple">
|
||
<li>Using <a class="reference internal" href="../glossary/s.html#term-stack-allocation"><em class="xref std std-term">stack-allocated</em></a> structures
|
||
beyond their <a class="reference internal" href="../glossary/l.html#term-lifetime"><em class="xref std std-term">lifetimes</em></a> (see <a class="reference internal" href="../glossary/u.html#term-use-after-free"><em class="xref std std-term">use
|
||
after free</em></a>);</li>
|
||
<li>Using <a class="reference internal" href="../glossary/h.html#term-heap-allocation"><em class="xref std std-term">heap-allocated</em></a> structures
|
||
after <a class="reference internal" href="../glossary/f.html#term-free-1"><em class="xref std std-term">freeing</em></a> them (see <a class="reference internal" href="../glossary/u.html#term-use-after-free"><em class="xref std std-term">use after
|
||
free</em></a>);</li>
|
||
<li>Neglecting to free heap-allocated objects when they are no
|
||
longer required (see <a class="reference internal" href="../glossary/m.html#term-memory-leak"><em class="xref std std-term">memory leak</em></a>);</li>
|
||
<li>Excessive copying by copy <a class="reference internal" href="../glossary/c.html#term-constructor-1"><em class="xref std std-term">constructors<sup>(1)</sup></em></a>;</li>
|
||
<li>Unexpected sharing due to insufficient copying by copy
|
||
constructors;</li>
|
||
<li>Allocating insufficient memory for the intended contents;</li>
|
||
<li>Accessing arrays with indexes that are out of bounds.</li>
|
||
</ol>
|
||
<div class="admonition-historical-note admonition">
|
||
<p class="first admonition-title">Historical note</p>
|
||
<p class="last">C++ was designed by Bjarne Stroustrup, as a minimal
|
||
object-oriented extension to C. It has since grown to
|
||
include some other modern programming language ideas. The
|
||
first implementations were preprocessors that produced C
|
||
code, but modern implementations are dedicated C++
|
||
compilers.</p>
|
||
</div>
|
||
<p>Ellis and Stroustrup write in <em>The Annotated C++ Reference
|
||
Manual</em>:</p>
|
||
<blockquote>
|
||
<div>C programmers think memory management is too important to
|
||
be left to the computer. Lisp programmers think memory
|
||
management is too important to be left to the user.</div></blockquote>
|
||
<div class="admonition-see-also admonition seealso">
|
||
<p class="first admonition-title">See also</p>
|
||
<p class="last"><a class="reference internal" href="../glossary/c.html#term-constructor-2"><em class="xref std std-term">constructor<sup>(2)</sup></em></a>, <a class="reference internal" href="../glossary/d.html#term-destructor-2"><em class="xref std std-term">destructor<sup>(2)</sup></em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-publication admonition">
|
||
<p class="first admonition-title">Related publications</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#attardi94"><em>Attardi & Flagella (1994)</em></a>, <a class="reference internal" href="bib.html#bartlett89"><em>Bartlett (1989)</em></a>, <a class="reference internal" href="bib.html#bw88"><em>Boehm & Weiser (1988)</em></a>, <a class="reference internal" href="bib.html#edelson92"><em>Edelson (1992)</em></a>, <a class="reference internal" href="bib.html#ellis93"><em>Ellis (1993)</em></a>, <a class="reference internal" href="bib.html#zorn93"><em>Zorn (1993)</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://www.parashift.com/c++-faq/">comp.lang.c++ FAQ</a>,
|
||
<a class="reference external" href="http://www.open-std.org/jtc1/sc22/wg21/">C++ standardization</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-dylan">Dylan</dt>
|
||
<dd><p class="first">Dylan is a modern programming language invented by Apple
|
||
around 1993 and developed by <a class="reference external" href="http://en.wikipedia.org/wiki/Harlequin_(software_company)">Harlequin</a>
|
||
and other partners. The language is a distillation of the best
|
||
ideas in dynamic and object-oriented programming. Its
|
||
ancestors include <a class="reference internal" href="#term-lisp"><em class="xref std std-term">Lisp</em></a>, <a class="reference internal" href="#term-smalltalk"><em class="xref std std-term">Smalltalk</em></a>, and
|
||
<a class="reference internal" href="#term-6"><em class="xref std std-term">C++</em></a>. Dylan is aimed at building modular component
|
||
software and delivering safe, compact applications. It also
|
||
facilitates the rapid development and incremental refinement
|
||
of prototype programs.</p>
|
||
<p>Dylan provides <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic memory management</em></a>. The
|
||
generic allocation function is called <tt class="docutils literal"><span class="pre">make</span></tt>. Most
|
||
implementations provide <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a> and <a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weak</em></a> hash tables, although interfaces for
|
||
these features have not yet been standardized. An object may
|
||
be registered for finalization via the function
|
||
<tt class="docutils literal"><span class="pre">finalize-when-unreachable</span></tt>, in which case there will be a
|
||
call to the <tt class="docutils literal"><span class="pre">finalize</span></tt> function once the <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage
|
||
collector</em></a> has determined that the object is
|
||
<a class="reference internal" href="../glossary/u.html#term-unreachable"><em class="xref std std-term">unreachable</em></a>. Weak hash tables may have either weak
|
||
keys or values, depending on a parameter supplied at
|
||
allocation time. A hash table entry will be deleted once the
|
||
garbage collector has determined that there are no
|
||
<a class="reference internal" href="../glossary/s.html#term-strong-reference"><em class="xref std std-term">strong references</em></a> to the key or value of the entry,
|
||
for weak key or value tables, respectively.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://opendylan.org/">Open Dylan</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-emacs-lisp">Emacs Lisp</dt>
|
||
<dd><p class="first">Emacs Lisp or elisp is a dialect of <a class="reference internal" href="#term-lisp"><em class="xref std std-term">Lisp</em></a> used in the
|
||
Emacs family of text editors, of which the most widely-used is
|
||
<a class="reference external" href="http://www.gnu.org/software/emacs/emacs.html">GNU Emacs</a>.</p>
|
||
<p>Like most Lisps, Emacs Lisp requires <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage
|
||
collection</em></a>. GNU Emacs has a simple <a class="reference internal" href="../glossary/m.html#term-mark-sweep"><em class="xref std std-term">mark-sweep</em></a>
|
||
collector. It has been speculated that the
|
||
non-<a class="reference internal" href="../glossary/i.html#term-incremental-garbage-collection"><em class="xref std std-term">incremental</em></a>
|
||
nature of the Emacs collector, combined with the fact that,
|
||
prior to version 19.31 (May 1996), it printed a message
|
||
whenever it collected, gave garbage collection a bad name in
|
||
programming circles.</p>
|
||
<p>Erik Naggum reported at the time:</p>
|
||
<blockquote>
|
||
<div>I have run some tests at the U of Oslo with about 100
|
||
users who generally agreed that Emacs had become faster in
|
||
the latest Emacs pretest. All I had done was to remove the
|
||
“Garbage collecting” message which people perceive as
|
||
slowing Emacs down and tell them that it had been sped up.
|
||
It is, somehow, permissible for a program to take a lot of
|
||
time doing any other task than administrative duties like
|
||
garbage collection.</div></blockquote>
|
||
<p>Emacs was originally written in Teco, not in Lisp, but it
|
||
still had a garbage collector, though this was heuristic and
|
||
conservative in nature. Teco-based Emacs was capable of
|
||
running for weeks at a time in a 256 kB <a class="reference internal" href="../glossary/a.html#term-address-space"><em class="xref std std-term">address space</em></a>.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://www.gnu.org/software/emacs/manual/elisp.html">GNU Emacs Lisp Reference Manual</a>,
|
||
<a class="reference external" href="http://www.gnu.org/software/emacs/manual/html_node/elisp/Garbage-Collection.html">Entry on Garbage Collection</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-fortran">Fortran</dt>
|
||
<dd><p class="first">Fortran, created in 1957, was one of the first languages
|
||
qualifying as a high-level language. It is popular among
|
||
scientists and has substantial support in the form of
|
||
numerical libraries.</p>
|
||
<p>Early versions of Fortran required the size of arrays to be
|
||
known at compilation time, and the earliest Fortran compilers
|
||
accordingly used only <a class="reference internal" href="../glossary/s.html#term-static-allocation"><em class="xref std std-term">static allocation</em></a> (however, the
|
||
1966 standard gave compiler writers freedom to use other
|
||
allocation mechanisms).</p>
|
||
<p>The Fortran 90 standard added recursion and automatic arrays
|
||
with <a class="reference internal" href="../glossary/s.html#term-stack-allocation"><em class="xref std std-term">stack allocation</em></a> semantics (though many compilers
|
||
in fact allocate them on the <a class="reference internal" href="../glossary/h.html#term-heap"><em class="xref std std-term">heap</em></a>). It also added
|
||
<a class="reference internal" href="../glossary/d.html#term-dynamic-allocation"><em class="xref std std-term">dynamic allocation</em></a> using <tt class="docutils literal"><span class="pre">ALLOCATE</span></tt> with manual
|
||
deallocation using <tt class="docutils literal"><span class="pre">DEALLOCATE</span></tt>. Fortran 95 made it explicit
|
||
that allocated arrays have <a class="reference internal" href="../glossary/d.html#term-dynamic-extent"><em class="xref std std-term">dynamic extent</em></a> and are
|
||
automatically deallocated when they go out of scope.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.j3-fortran.org/">Fortran standardization</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-java">Java</dt>
|
||
<dd><p class="first">A modern object-oriented language with a rich collection of
|
||
useful features. The Java language started as an attempt by
|
||
the Java group at Sun Microsystems to overcome software
|
||
engineering problems introduced by <a class="reference internal" href="#term-6"><em class="xref std std-term">C++</em></a>. Key reasons
|
||
for the language’s success were the security model and the
|
||
portable execution environment, the Java Virtual Machine
|
||
(JVM), which created a lot of interest for it as a platform
|
||
for distributed computing on open networks.</p>
|
||
<p>Java is <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage-collected</em></a>, as
|
||
this facilitates object-oriented programming and is essential
|
||
for security (which <a class="reference internal" href="../glossary/u.html#term-use-after-free"><em class="xref std std-term">use after free</em></a> would break). It
|
||
had <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a> from version 1.0 and three kinds of
|
||
<a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weakness</em></a> from version 1.2
|
||
(confusingly, part of the Java 2 Platform).</p>
|
||
<p>Early JVMs had simple collectors that didn’t scale well for
|
||
large programs, but the current crop is catching up to the
|
||
state of the art.</p>
|
||
<div class="admonition-see-also last admonition seealso">
|
||
<p class="first admonition-title">See also</p>
|
||
<p class="last"><a class="reference internal" href="../glossary/r.html#term-reference-object"><em class="xref std std-term">reference object</em></a>, <a class="reference internal" href="../glossary/s.html#term-strong-reference"><em class="xref std std-term">strong reference</em></a>, <a class="reference internal" href="../glossary/s.html#term-soft-reference"><em class="xref std std-term">soft reference</em></a>, <a class="reference internal" href="../glossary/w.html#term-weak-reference-2"><em class="xref std std-term">weak reference<sup>(2)</sup></em></a>, <a class="reference internal" href="../glossary/p.html#term-phantom-reference"><em class="xref std std-term">phantom reference</em></a>, <a class="reference internal" href="../glossary/s.html#term-strongly-reachable"><em class="xref std std-term">strongly reachable</em></a>, <a class="reference internal" href="../glossary/s.html#term-softly-reachable"><em class="xref std std-term">softly reachable</em></a>, <a class="reference internal" href="../glossary/w.html#term-weakly-reachable"><em class="xref std std-term">weakly reachable</em></a>, <a class="reference internal" href="../glossary/p.html#term-phantom-reachable"><em class="xref std std-term">phantom reachable</em></a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-javascript">JavaScript</dt>
|
||
<dd><p class="first">JavaScript is a scripting language used by web browsers. The
|
||
loose type system resembles other scripting languages,
|
||
although the syntax follows <a class="reference internal" href="#term-c"><em class="xref std std-term">C</em></a>. There’s a
|
||
prototype-based object system. Note that JavaScript is not
|
||
related to <a class="reference internal" href="#term-java"><em class="xref std std-term">Java</em></a> in any way except name. There’s a
|
||
standard by <a class="reference external" href="http://www.ecma-international.org">ECMA</a>, known
|
||
as ECMAScript.</p>
|
||
<p>Despite the <a class="reference internal" href="#term-6"><em class="xref std std-term">C++</em></a>-like syntax (with <tt class="docutils literal"><span class="pre">new</span></tt> and
|
||
<tt class="docutils literal"><span class="pre">delete</span></tt> operators), JavaScript is <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage-collected</em></a>.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">Standard ECMA-262: ECMAScript Language Specification</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-lisp">Lisp</dt>
|
||
<dd><p class="first">Lisp is a family of computer languages combining functional
|
||
and procedural features with automatic memory management.</p>
|
||
<p>Lisp was invented by John McCarthy around 1958 for the
|
||
manipulation of symbolic expressions. As part of the original
|
||
implementation of Lisp, he invented <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage
|
||
collection</em></a>. He noted:</p>
|
||
<blockquote>
|
||
<div>This process, because it is entirely automatic, is more
|
||
convenient for the programmer than a system in which he
|
||
has to keep track of lists and erase unwanted lists.</div></blockquote>
|
||
<p>Modern Lisp implementations, such as <a class="reference external" href="http://www.lispworks.com/">LispWorks</a> and <a class="reference external" href="http://www.franz.com/products/allegro-common-lisp/">Allegro CL</a>, have
|
||
advanced <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collectors</em></a>.</p>
|
||
<p>Lisp is now used for all kinds of symbolic programming and
|
||
other advanced software development. Major dialects today are
|
||
<a class="reference internal" href="#term-emacs-lisp"><em class="xref std std-term">Emacs Lisp</em></a>, <a class="reference internal" href="#term-common-lisp"><em class="xref std std-term">Common Lisp</em></a> and <a class="reference internal" href="#term-scheme"><em class="xref std std-term">Scheme</em></a>.
|
||
Most modern dialects and related languages, such as
|
||
<a class="reference internal" href="#term-dylan"><em class="xref std std-term">Dylan</em></a>, are object-oriented.</p>
|
||
<div class="admonition-see-also admonition seealso">
|
||
<p class="first admonition-title">See also</p>
|
||
<p class="last"><a class="reference internal" href="../glossary/c.html#term-cons-1"><em class="xref std std-term">cons<sup>(1)</sup></em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-publication admonition">
|
||
<p class="first admonition-title">Related publications</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#baker78"><em>Baker (1978)</em></a>, <a class="reference internal" href="bib.html#edwards"><em>Edwards</em></a>, <a class="reference internal" href="bib.html#mm59"><em>McCarthy & Minsky (1959)</em></a>, <a class="reference internal" href="bib.html#mccarthy60"><em>McCarthy (1960)</em></a>, <a class="reference internal" href="bib.html#mccarthy79"><em>McCarthy (1979)</em></a>, <a class="reference internal" href="bib.html#moon84"><em>Moon (1984)</em></a>, <a class="reference internal" href="bib.html#moon87"><em>Moon (1990)</em></a>, <a class="reference internal" href="bib.html#moon91"><em>Moon (1991)</em></a>, <a class="reference internal" href="bib.html#sobalvarro88"><em>Sobalvarro (1988)</em></a>, <a class="reference internal" href="bib.html#zorn88"><em>Zorn (1988)</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.lispworks.com/documentation/HyperSpec/Front/">Common Lisp HyperSpec</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-lisp-machine">Lisp Machine</dt>
|
||
<dd><p class="first">Of particular interest in the history of memory management are
|
||
the <em>Lisp Machines</em>, early workstation computers built around
|
||
a custom processor designed to improve the execution speed of
|
||
Lisp by implementing primitive Lisp operations in microcode.
|
||
The Lisp Machine <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collector</em></a> is a generalization
|
||
of the algorithm described in <a class="reference internal" href="bib.html#baker78"><em>Baker (1978)</em></a>
|
||
and used a technique similar to that described in <a class="reference internal" href="bib.html#ungar84"><em>Ungar
|
||
(1984)</em></a>, but utilizing hardware to improve
|
||
performance.</p>
|
||
<p>A description of the garbage collector of one particular model
|
||
is in <a class="reference internal" href="bib.html#moon84"><em>Moon (1984)</em></a>. The features important for
|
||
its performance were:</p>
|
||
<ol class="arabic simple">
|
||
<li>Hardware support for data typing using <a class="reference internal" href="../glossary/t.html#term-tag"><em class="xref std std-term">tags</em></a>;</li>
|
||
<li>Reference-based <a class="reference internal" href="../glossary/r.html#term-read-barrier"><em class="xref std std-term">read barriers</em></a> for
|
||
<a class="reference internal" href="../glossary/i.html#term-incremental-garbage-collection"><em class="xref std std-term">incremental</em></a>
|
||
collecting;</li>
|
||
<li><a class="reference internal" href="../glossary/w.html#term-write-barrier"><em class="xref std std-term">Write barriers</em></a> for <a class="reference internal" href="../glossary/r.html#term-remembered-set"><em class="xref std std-term">remembered sets</em></a> and
|
||
<a class="reference internal" href="../glossary/g.html#term-generational-garbage-collection"><em class="xref std std-term">generational</em></a>
|
||
collecting;</li>
|
||
<li>A tight integration with the <a class="reference internal" href="../glossary/v.html#term-virtual-memory"><em class="xref std std-term">virtual memory</em></a>
|
||
system.</li>
|
||
</ol>
|
||
<p>The remembered sets were based on a <a class="reference internal" href="../glossary/b.html#term-bibop"><em class="xref std std-term">BIBOP</em></a> division of
|
||
the virtual <a class="reference internal" href="../glossary/a.html#term-address-space"><em class="xref std std-term">address space</em></a>. The Lisp Machine
|
||
<a class="reference internal" href="../glossary/p.html#term-page-table"><em class="xref std std-term">page table</em></a>, unlike virtually all modern virtual memory
|
||
systems, was a flat, hash-based table (sometimes called an
|
||
<a class="reference internal" href="../glossary/i.html#term-inverted-page-table"><em class="xref std std-term">inverted page table</em></a>), and thus insensitive to
|
||
sparsely-populated virtual address spaces associated with
|
||
BIBOP schemes.</p>
|
||
<p class="last">These custom processors eventually lost out to rapidly
|
||
advancing stock hardware. Many of the techniques pioneered on
|
||
Lisp Machines are used in today’s implementations, at a cost
|
||
of a few more cycles.</p>
|
||
</dd>
|
||
<dt id="term-lua">Lua</dt>
|
||
<dd><p class="first">Lua is a dynamically typed language created by Roberto
|
||
Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes
|
||
in 1993. The language supports object-oriented and functional
|
||
styles of programming, and is designed to be easily embedded
|
||
in a larger programming system as an extension or scripting
|
||
language.</p>
|
||
<p>Lua uses <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic memory management</em></a> and comes with a
|
||
<a class="reference internal" href="../glossary/n.html#term-non-moving-garbage-collector"><em class="xref std std-term">non-moving</em></a>
|
||
<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-garbage-collector"><em class="xref std std-term">garbage collector</em></a> supporting soft real time
|
||
applications. This uses a software <a class="reference internal" href="../glossary/b.html#term-barrier-1"><em class="xref std std-term">barrier<sup>(1)</sup></em></a> in
|
||
order to be highly portable.</p>
|
||
<p>The language supports <a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weak references<sup>(1)</sup></em></a> in the form
|
||
of weak (hash) tables, which have the unusual feature that
|
||
their keys and values can be dynamically switched from being
|
||
<a class="reference internal" href="../glossary/s.html#term-strong-reference"><em class="xref std std-term">strong references</em></a> to weak references, and vice versa
|
||
(by assigning to the <tt class="docutils literal"><span class="pre">__mode</span></tt> field of the table’s
|
||
metatable). It also supports <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a> (by
|
||
assigning the <tt class="docutils literal"><span class="pre">__gc</span></tt> field of the object’s metatable).</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://lua.org">Lua</a>,
|
||
<a class="reference external" href="http://www.lua.org/manual/5.1/manual.html#2.10">Garbage Collection</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-ml">ML</dt>
|
||
<dd><p class="first">ML is a family of strongly-typed functional languages, of
|
||
which the principal members are Standard ML and Caml.</p>
|
||
<p>Like other functional languages, ML provides <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic
|
||
memory management</em></a>. Modern ML implementations usually have
|
||
advanced <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collectors</em></a>. The combination of clean
|
||
functional semantics and strong typing allows advanced
|
||
techniques, such as <a class="reference internal" href="../glossary/r.html#term-region-inference"><em class="xref std std-term">region inference</em></a>.</p>
|
||
<p>The Standard ML of New Jersey (SML/NJ) system, which
|
||
implements a slight variant of Standard ML, has been important
|
||
to memory management research for three reasons. Firstly, the
|
||
source code is publicly available and widely ported, allowing
|
||
experimentation with both the <a class="reference internal" href="../glossary/c.html#term-collector-2"><em class="xref std std-term">collector<sup>(2)</sup></em></a> and
|
||
<a class="reference internal" href="../glossary/m.html#term-mutator"><em class="xref std std-term">mutator</em></a>. Secondly, the compiler generates code that
|
||
does not use a <a class="reference internal" href="../glossary/c.html#term-control-stack"><em class="xref std std-term">control stack</em></a>, but <a class="reference internal" href="../glossary/a.html#term-allocate"><em class="xref std std-term">allocates</em></a>
|
||
function <a class="reference internal" href="../glossary/a.html#term-activation-record"><em class="xref std std-term">activation records</em></a> on the <a class="reference internal" href="../glossary/h.html#term-heap"><em class="xref std std-term">heap</em></a>
|
||
instead. This means that the allocation rate is very high (up
|
||
to one byte per instruction), and also that the collector has
|
||
a very small <a class="reference internal" href="../glossary/r.html#term-root-set"><em class="xref std std-term">root set</em></a>. Thirdly, it uses a simple
|
||
<a class="reference internal" href="../glossary/c.html#term-copying-garbage-collection"><em class="xref std std-term">copying collector</em></a> that is
|
||
easy to modify.</p>
|
||
<div class="admonition-see-also admonition seealso">
|
||
<p class="first admonition-title">See also</p>
|
||
<p class="last"><a class="reference internal" href="../glossary/i.html#term-immutable"><em class="xref std std-term">immutable</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-publication admonition">
|
||
<p class="first admonition-title">Related publications</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#cns92"><em>Cooper et al. (1992)</em></a>, <a class="reference internal" href="bib.html#doligez93"><em>Doligez (1993)</em></a>, <a class="reference internal" href="bib.html#tt97"><em>Tofte & Talpin (1997)</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.faqs.org/faqs/meta-lang-faq/">comp.lang.ml FAQ</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-modula-3">Modula-3</dt>
|
||
<dd><p class="first">An object-oriented descendant of <a class="reference internal" href="#term-pascal"><em class="xref std std-term">Pascal</em></a>.</p>
|
||
<p>Modula-3 is mostly <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage-collected</em></a>, although it is possible to use <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual
|
||
memory management</em></a> in certain modules.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://www.modula3.org/">modula3.org</a>,
|
||
<a class="reference external" href="http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-52.pdf">Modula-3 language definition</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-pascal">Pascal</dt>
|
||
<dd><p class="first">An imperative language characterized by block structure and a
|
||
relatively strong (for its time) static type system. Pascal
|
||
was designed by Niklaus Wirth around 1970.</p>
|
||
<p>Pascal was popular as a teaching language due to its small
|
||
size, but it lacked many features needed for applications
|
||
programming. Now it’s been largely supplanted by its more
|
||
feature-rich descendants Modula-2, <a class="reference internal" href="#term-modula-3"><em class="xref std std-term">Modula-3</em></a>, and
|
||
Oberon, mainly surviving in the popular Delphi development
|
||
tool.</p>
|
||
<p>Pascal uses <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual memory management</em></a> (with the
|
||
operators <tt class="docutils literal"><span class="pre">NEW</span></tt> and <tt class="docutils literal"><span class="pre">DISPOSE</span></tt>). The descendants mentioned
|
||
all offer <a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">automatic memory management</em></a>.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://www.borland.com/delphi/">Borland Delphi Home Page</a>,
|
||
<a class="reference external" href="http://www.open-std.org/JTC1/sc22/docs/oldwgs/wg2.html">Pascal standardization</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-perl">Perl</dt>
|
||
<dd><p class="first">Perl is a complex but powerful language that is an eclectic
|
||
mixture of scripting languages and programming languages.</p>
|
||
<p>Perl programmers can work with strings, arrays, and
|
||
associative arrays without having to worry about <a class="reference internal" href="../glossary/m.html#term-manual-memory-management"><em class="xref std std-term">manual
|
||
memory management</em></a>. Perl is well-suited to complex text file
|
||
manipulation, such as report generation, file format
|
||
conversion, and web server CGI scripts. It is also useful for
|
||
rapid prototyping, but large Perl scripts are often
|
||
unmaintainable.</p>
|
||
<p>Perl’s <a class="reference internal" href="../glossary/m.html#term-memory-management"><em class="xref std std-term">memory management</em></a> is well-hidden, but is based
|
||
on <a class="reference internal" href="../glossary/r.html#term-reference-counting"><em class="xref std std-term">reference counts</em></a> and
|
||
<a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>. It also has <em>mortal</em> variables,
|
||
whose <a class="reference internal" href="../glossary/l.html#term-lifetime"><em class="xref std std-term">lifetimes</em></a> are limited to the current context. It
|
||
is possible to <a class="reference internal" href="../glossary/f.html#term-free-1"><em class="xref std std-term">free<sup>(1)</sup></em></a> the <a class="reference internal" href="../glossary/m.html#term-memory-2"><em class="xref std std-term">memory<sup>(2)</sup></em></a>
|
||
assigned to variables (including arrays) explicitly, by
|
||
<tt class="docutils literal"><span class="pre">undef</span></tt>-ing the only reference to them.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.perl.org/">The Perl Programming Language</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-postscript">PostScript</dt>
|
||
<dd><p class="first">The PostScript language is an interpretive language with
|
||
powerful graphics features, widely used as a page description
|
||
language for printers and typesetters.</p>
|
||
<p>The Level 1 PostScript language has a simple
|
||
<a class="reference internal" href="../glossary/s.html#term-stack"><em class="xref std std-term">stack</em></a>-like memory management model, using <tt class="docutils literal"><span class="pre">save</span></tt>
|
||
and <tt class="docutils literal"><span class="pre">restore</span></tt> operators to <a class="reference internal" href="../glossary/r.html#term-recycle"><em class="xref std std-term">recycle</em></a> memory. The Level
|
||
2 PostScript language adds <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a> to this
|
||
model.</p>
|
||
<div class="admonition-see-also admonition seealso">
|
||
<p class="first admonition-title">See also</p>
|
||
<p class="last"><a class="reference internal" href="../glossary/v.html#term-vm-2"><em class="xref std std-term">VM<sup>(2)</sup></em></a>, <a class="reference internal" href="../glossary/c.html#term-composite-object"><em class="xref std std-term">composite object</em></a>, <a class="reference internal" href="../glossary/s.html#term-simple-object"><em class="xref std std-term">simple object</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://en.wikipedia.org/wiki/Harlequin_RIP">Harlequin RIP</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-prolog">Prolog</dt>
|
||
<dd><p class="first">A logic programming language invented by Alain Colmerauer
|
||
around 1970, Prolog is popular in the AI and symbolic
|
||
computation community. It is special because it deals directly
|
||
with relationships and inference rather than functions or
|
||
commands.</p>
|
||
<p>Storage is usually managed using a <a class="reference internal" href="../glossary/g.html#term-garbage-collector"><em class="xref std std-term">garbage collector</em></a>,
|
||
but the complex control flow places special requirements on
|
||
the collector.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://people.sju.edu/~jhodgson/wg17/">Prolog Standardization</a>,
|
||
<a class="reference external" href="http://www.informatik.uni-trier.de/%7Eley/db/prolog/gc.html">Prolog Memory Management - Garbage Collection</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-python">Python</dt>
|
||
<dd><p class="first">Python is a “duck-typed” object-oriented language created in
|
||
the early 1990s by Guido van Rossum.</p>
|
||
<p>There are several implementations running on a variety of
|
||
virtual machines: the original “CPython” implementation runs
|
||
on its own virtual machine; IronPython runs on the Common
|
||
Language Runtime; Jython on the Java Virtual Machine.</p>
|
||
<p>CPython manages memory using a mixture of <a class="reference internal" href="../glossary/r.html#term-reference-counting"><em class="xref std std-term">reference
|
||
counting</em></a> and <a class="reference internal" href="../glossary/n.html#term-non-moving-memory-manager"><em class="xref std std-term">non-moving</em></a>
|
||
<a class="reference internal" href="../glossary/m.html#term-mark-and-sweep"><em class="xref std std-term">mark-and-sweep</em></a> <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>. Reference
|
||
counting ensures prompt deletion of objects when their
|
||
reference count falls to zero, while the garbage collector
|
||
reclaims <a class="reference internal" href="../glossary/c.html#term-cyclic-data-structure"><em class="xref std std-term">cyclic data structures</em></a>.</p>
|
||
<p>The language supports <a class="reference internal" href="../glossary/f.html#term-finalization"><em class="xref std std-term">finalization</em></a> (classes may have a
|
||
<tt class="docutils literal"><span class="pre">__del__</span></tt> method, which is run just before the object is
|
||
destroyed), and <a class="reference internal" href="../glossary/w.html#term-weak-reference-1"><em class="xref std std-term">weak references<sup>(1)</sup></em></a> (via the
|
||
<tt class="docutils literal"><span class="pre">weakref</span></tt> module).</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://python.org/">Python</a>,
|
||
<a class="reference external" href="http://docs.python.org/3/library/gc.html">Garbage Collector interface</a>,
|
||
<a class="reference external" href="http://docs.python.org/3/reference/datamodel.html#object.__del__">__del__ method</a>,
|
||
<a class="reference external" href="http://docs.python.org/3/library/weakref.html">weakref module</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-scheme">Scheme</dt>
|
||
<dd><p class="first">A small functional language blending influences from
|
||
<a class="reference internal" href="#term-lisp"><em class="xref std std-term">Lisp</em></a> and <a class="reference internal" href="#term-algol"><em class="xref std std-term">Algol</em></a>.</p>
|
||
<p>Key features of Scheme include symbol and list operations,
|
||
<a class="reference internal" href="../glossary/h.html#term-heap-allocation"><em class="xref std std-term">heap allocation</em></a> and <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>,
|
||
lexical scoping with first-class function objects (implying
|
||
<a class="reference internal" href="../glossary/c.html#term-closure"><em class="xref std std-term">closures</em></a>), reliable tail-call elimination (allowing
|
||
iterative procedures to be described tail-recursively), the
|
||
ability to dynamically obtain the current <a class="reference internal" href="../glossary/c.html#term-continuation"><em class="xref std std-term">continuation</em></a>
|
||
as a first-class object, and a language description that
|
||
includes a formal semantics.</p>
|
||
<p>Scheme has been gaining popularity as an extension language;
|
||
Project GNU’s extension package of choice, <a class="reference external" href="http://www.gnu.org/software/guile/">Guile</a>, is a Scheme
|
||
interpreter. <a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">Garbage collection</em></a> is an important part
|
||
of the ease of use that is expected from an extension
|
||
language.</p>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related links</p>
|
||
<p class="last"><a class="reference external" href="http://www.cs.indiana.edu/scheme-repository/doc.standards.html">Scheme Standards documents</a>,
|
||
<a class="reference external" href="http://srfi.schemers.org/">Scheme Requests for Implementation</a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-simula">Simula</dt>
|
||
<dd><p class="first">Simula was designed as a language for simulation, but it
|
||
expanded into a full general-purpose programming language and
|
||
the first object-oriented language.</p>
|
||
<p>Simula I, designed in 1962–64 by Kristen Nygaard and Ole-Johan
|
||
Dahl, was based on <a class="reference internal" href="#term-algol"><em class="xref std std-term">ALGOL</em></a> 60, but the <a class="reference internal" href="../glossary/s.html#term-stack-allocation"><em class="xref std std-term">stack
|
||
allocation</em></a> discipline was replaced by a two-dimensional
|
||
<a class="reference internal" href="../glossary/f.html#term-free-list"><em class="xref std std-term">free list</em></a>.</p>
|
||
<p>It was Simula 67 that pioneered classes and inheritance to
|
||
express behavior. This domain-oriented design was supported by
|
||
<a class="reference internal" href="../glossary/g.html#term-garbage-collection"><em class="xref std std-term">garbage collection</em></a>.</p>
|
||
<div class="admonition-related-publication last admonition">
|
||
<p class="first admonition-title">Related publication</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#dahl63"><em>Dahl (1963)</em></a>.</p>
|
||
</div>
|
||
</dd>
|
||
<dt id="term-smalltalk">Smalltalk</dt>
|
||
<dd><p class="first">Smalltalk is an object-oriented language with single
|
||
inheritance and message-passing.</p>
|
||
<p><a class="reference internal" href="../glossary/a.html#term-automatic-memory-management"><em class="xref std std-term">Automatic memory management</em></a> is an essential part of
|
||
the Smalltalk philosophy. Many important techniques were first
|
||
developed or implemented for Smalltalk.</p>
|
||
<div class="admonition-related-publication admonition">
|
||
<p class="first admonition-title">Related publications</p>
|
||
<p class="last"><a class="reference internal" href="bib.html#db76"><em>Deutsch & Bobrow (1976)</em></a>, <a class="reference internal" href="bib.html#ungar84"><em>Ungar (1984)</em></a>, <a class="reference internal" href="bib.html#ungar88"><em>Ungar (1988)</em></a>.</p>
|
||
</div>
|
||
<div class="admonition-related-link last admonition">
|
||
<p class="first admonition-title">Related link</p>
|
||
<p class="last"><a class="reference external" href="http://www.smalltalk.org/versions/ANSIStandardSmalltalk.html">Smalltalk standardization</a>.</p>
|
||
</div>
|
||
</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="recycle.html"
|
||
title="previous chapter">3. Recycling techniques</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="faq.html"
|
||
title="next chapter">5. Frequently Asked Questions</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="faq.html" title="5. Frequently Asked Questions"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="recycle.html" title="3. Recycling techniques"
|
||
>previous</a> |</li>
|
||
<li><a href="../index.html">Memory Pool System 1.111.0 documentation</a> »</li>
|
||
<li><a href="index.html" >Introduction to memory management</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> |