Tombstone (programming)

Tombstone (programming)

Tombstones are a mechanism to detect dangling pointers that can appear in certain computer programming languages, e. g. C, C++ and assembly languages, and to act as a containment to their dangerous effects.

A tombstone is a structure that acts as an intermediary between a pointer and the heap-dynamic data in memory. The pointer points only at tombstones and never to the memory that holds the actual value. When the data is deallocated, the tombstone is set to a null value (or, more generally, to a value that is illegal for a pointer in the given runtime environment), indicating that the variable no longer exists. This prevents the use of invalid pointers, which would otherwise access the memory area that once belonged to the now deallocated variable, although it may already contain other data, in turn leading to corruption of in-memory data. Depending on the operating system, the CPU can automatically detect such an invalid access (e. g. for the null value: a "null pointer dereference error"). This supports in analyzing the actual reason, a programming error, in debugging, and it can also be used to abort the program in production use, to prevent it from continuing with invalid data structures.

The downsides of using tombstones include a computational overhead and additional memory consumption: extra processing is necessary to follow the path from the pointer to data through the tombstone, and extra memory is necessary to retain tombstones for every pointer throughout the program. One other problem is that all the code — that needs to work with the pointers in question — needs to be implemented to use the tombstone mechanism.

No popular programming language currently uses tombstones. However, built–in support by the programming language or the compiler is not necessary to use them.

ee also

*Locks-and-keys


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Tombstone (disambiguation) — A tombstone is a headstone marking the grave of a deceased person.Tombstone may also refer to: *Tombstone, Arizona, a town in Arizona * Tombstone (film), a 1993 western *Tombstone (pizza), a brand of frozen pizza *Tombstone (manufacturing), a… …   Wikipedia

  • Locks-and-keys — is a solution to dangling pointers in computer programming languages.The locks and keys approach represents pointers as ordered pairs (key, address) where the key is an integer value. Heap dynamic variables are represented as the storage for the… …   Wikipedia

  • List of Spider-Man (1994 TV series) characters — This is a list of characters from Spider Man (1994 TV series). Contents 1 Heroes and allies 1.1 Spider Man/Peter Parker 1.2 Blade 1.3 The Black Cat/Felicia Hardy …   Wikipedia

  • Tippmann A-5 — paintball marker marker type=Mechanical caption= Tippmann A 5 Basic with aftermarket 12 ceramic barrel by J J and BSA 30mm red dot sight. action= Semi Automatic, Fully Automatic with E Grip bore= .68 in (17.272 mm) barrel= 8.5 in (216 mm) ported… …   Wikipedia

  • Woburn Collegiate Institute — Infobox Education in Canada name= Woburn Collegiate Institute imagesize= motto= Studium Eruditionis Crescat motto translation= Let the zeal for learning flourish streetaddress= 2222 Ellesmere Road city= Toronto province= Ontario postalcode= M1G… …   Wikipedia

  • Star Trek: The Original Series — Star Trek Star Trek title card (Season 1) Format Science fiction Created by Gene Roddenberry …   Wikipedia

  • Doctor Octopus — This article is about the first Doctor Octopus, Otto Octavius. For the second Doctor Octopus, see Lady Octopus. Doctor Octopus Doctor Octopus drawn by John Romita Jr. Publication information …   Wikipedia

  • Cox Communications — Cox Communications, Inc. Type Subsidiary Industry Telecommunications Founded 1962 Headquarters …   Wikipedia

  • WWE Home Video — The WWE Home Video logo. WWE Home Video is a video distribution and production company that distributes WWE programming. A division of WWE formed in 1997 as WWF Home Video, it replaced a similar independent company owned by Evart Enterprises,… …   Wikipedia

  • Bret Hart — This article is about the professional wrestler. For the author, see Bret Harte. For other uses, see Hitman (disambiguation). Bret Hart Hart in 2010. Ring name(s) Bret Hart …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”