• The most common bugs related to pointer & memory management is called dangling or wild pointers.
  • Sometimes programmer fails to assign the pointer with a valid address, then this type of assigned or initialized pointer is known as dangling pointer.
  • Dangling pointer usually occurs during object destruction when the object is deleted or deallocated from memory without changing the values or address of the pointer.
  • Dangling pointer points to the memory which contains either the program code or code of the operating system.
  • If a value or address is assigned to this type of pointer, it overwrites the program’s value or operating system instructions.
  • During this time, the program may show the undesirable results or may crash.
  • If the memory is re allocated to some other process, then we will dereference the dangling pointer.
  • This dereferencing of the dangling pointer may cause segmentation faults.

Categorized in: