Memory Safety - Detection

Detection

There are many different ways to detect memory errors in programs written in unsafe languages:

  • By using special heap allocators that provide dead zones around heap allocated storage, and check that accesses don't reach into such dead zones. DieHard does this by allocating objects in their own virtual memory page.
  • By instrumenting the source code. Tools like SoftBound and CheckPointer do this to collect and track legitimate values for pointers ("metadata") and check each pointer access against the metadata for validity.
  • By running the compiled program in a memory-checking virtual machine. The memcheck tool of Valgrind works this way.
  • Static code analysis can detect errors in some cases as well.

Read more about this topic:  Memory Safety