Dangling Pointer

Dangling Pointer

Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. These are special cases of memory safety violations.

Dangling pointers arise when an object is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory. As the system may reallocate the previously freed memory to another process, if the original program then dereferences the (now) dangling pointer, unpredictable behavior may result, as the memory may now contain completely different data. This is especially the case if the program writes data to memory pointed by a dangling pointer, a silent corruption of unrelated data may result, leading to subtle bugs that can be extremely difficult to find, or cause segmentation faults (*NIX) or general protection faults (Windows). If the overwritten data is bookkeeping data used by the system's memory allocator, the corruption can cause system instabilities.

Wild pointers arise when a pointer is used prior to initialization to some known state, which is possible in some programming languages. They show the same erratic behaviour as dangling pointers, though they are less likely to stay undetected.

Read more about Dangling Pointer:  Cause of Dangling Pointers, Cause of Wild Pointers, Security Holes Involving Dangling Pointers, Avoiding Dangling Pointer Errors, Dangling Pointer Detection

Famous quotes containing the words dangling and/or pointer:

    And, indeed, is there not something holy about a great kitchen?... The scoured gleam of row upon row of metal vessels dangling from hooks or reposing on their shelves till needed with the air of so many chalices waiting for the celebration of the sacrament of food. And the range like an altar, yes, before which my mother bowed in perpetual homage, a fringe of sweat upon her upper lip and the fire glowing in her cheeks.
    Angela Carter (1940–1992)

    The hardiest skeptic who has seen a horse broken, a pointer trained, or has visited a menagerie or the exhibition of the Industrious Fleas, will not deny the validity of education. “A boy,” says Plato, “is the most vicious of all beasts;” and in the same spirit the old English poet Gascoigne says, “A boy is better unborn than untaught.”
    Ralph Waldo Emerson (1803–1882)