Types of Memory Errors
Several types of memory errors can occur, depending on which programming language is used:
- Buffer overflow - Out-of bound writes can corrupt the content of adjacent objects, or internal data like bookkeeping information for the heap or return addresses.
- Dynamic memory errors - Incorrect management of dynamic memory and pointers:
- Dangling pointer - A pointer storing the address of an object that has been deleted.
- Double frees - Repeated call to free though the object has been already freed can cause freelist-based allocators to fail.
- Invalid Free - Passing an invalid address to free can corrupt the heap. Or sometimes will lead to an undefined behavior.
- Null pointer accesses will cause an exception or program termination in most environments, but can cause corruption in operating system kernels or systems without memory protection, or when use of the null pointer involves a large or negative offset.
- Uninitialized variables - A variable that has not been assigned a value is used. It may contain an undesired or, in some languages, a corrupt value.
- Wild pointers arise when a pointer is used prior to initialization to some known state. They show the same erratic behaviour as dangling pointers, though they are less likely to stay undetected.
- Out of memory errors:
- Stack overflow - Occurs when a program runs out of stack space, typically because of too deep recursion.
- Allocation failures - The program tries to use more memory than the amount available. In some languages, this condition must be checked for manually after each allocation.
Read more about this topic: Memory Safety
Famous quotes containing the words types of, types, memory and/or errors:
“... there are two types of happiness and I have chosen that of the murderers. For I am happy. There was a time when I thought I had reached the limit of distress. Beyond that limit, there is a sterile and magnificent happiness.”
—Albert Camus (19131960)
“As for types like my own, obscurely motivated by the conviction that our existence was worthless if we didnt make a turning point of it, we were assigned to the humanities, to poetry, philosophy, paintingthe nursery games of humankind, which had to be left behind when the age of science began. The humanities would be called upon to choose a wallpaper for the crypt, as the end drew near.”
—Saul Bellow (b. 1915)
“A Church which has lost its memory is in a sad state of senility.”
—Henry Chadwick (b. 1920)
“Generally speaking, the errors in religion are dangerous; those in philosophy only ridiculous.”
—David Hume (17111776)