Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Stale pointer bug
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
A '''stale pointer bug''', otherwise known as an '''aliasing bug''', is a class of subtle programming errors that can arise in code that does [[dynamic memory allocation]], especially via the [[malloc]] function or equivalent. If several [[pointer (computer programming)|pointer]]s address (are "[[pointer aliasing|aliases]] for") 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,<ref name="FOLDOC">{{foldoc|stale+pointer+bug}}</ref> 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]]. The term "aliasing bug" 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.<ref name="FOLDOC" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)