<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Stale_pointer_bug</id>
	<title>Stale pointer bug - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Stale_pointer_bug"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Stale_pointer_bug&amp;action=history"/>
	<updated>2026-06-23T12:54:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Stale_pointer_bug&amp;diff=296870&amp;oldid=prev</id>
		<title>imported&gt;NeLaS: Added short description</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Stale_pointer_bug&amp;diff=296870&amp;oldid=prev"/>
		<updated>2025-11-05T05:13:19Z</updated>

		<summary type="html">&lt;p&gt;Added short description&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Software programming error}}&lt;br /&gt;
A &amp;#039;&amp;#039;&amp;#039;stale pointer bug&amp;#039;&amp;#039;&amp;#039;, otherwise known as an &amp;#039;&amp;#039;&amp;#039;aliasing bug&amp;#039;&amp;#039;&amp;#039;, is a class of subtle programming errors that can arise in code that does [[dynamic memory allocation]], especially via the [[malloc]] function or equivalent.&lt;br /&gt;
&lt;br /&gt;
If several [[pointer (computer programming)|pointer]]s address (are &amp;quot;[[pointer aliasing|aliases]] for&amp;quot;) a given chunk of storage, it may happen that the storage is freed or reallocated (and thus moved) through one alias and then referenced through another, which may lead to subtle (and possibly intermittent) errors depending on the state and the allocation history of the malloc arena. This bug can be avoided by never creating aliases for allocated memory,&amp;lt;ref name=&amp;quot;FOLDOC&amp;quot;&amp;gt;{{foldoc|stale+pointer+bug}}&amp;lt;/ref&amp;gt; by controlling the dynamic [[scope (programming)|scope]] of references to the storage so that none can remain when it is freed, or by use of a [[garbage collection (computer science)|garbage collector]], in the form of an intelligent memory-allocation library or as provided by [[high-level programming language|higher-level languages]], such as [[Lisp programming language|Lisp]].&lt;br /&gt;
&lt;br /&gt;
The term &amp;quot;aliasing bug&amp;quot; is nowadays associated with [[C (programming language)|C]] programming, but it was already in use in a very similar sense in the [[ALGOL]] 60 and [[Fortran]] programming language communities in the 1960s.&amp;lt;ref name=&amp;quot;FOLDOC&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Dangling pointer]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Software bugs]]&lt;br /&gt;
[[Category:Software_anomalies]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{software-eng-stub}}&lt;/div&gt;</summary>
		<author><name>imported&gt;NeLaS</name></author>
	</entry>
</feed>