• Ensure a program get and only get expected data from Main Memory and Register
  • To achieve Memory Safety, we need to achieve the absence of undefined behaviour


It can be perfectly safe to have a pointer to freed memory. The important thing is to not use that pointer again, like reading it or freeing it etc

Poor Memory Safety

Achieve Memory Safety


  • Ensure Memory Safety at compile time, reducing potential runtime errors without sacrificing speed


  • Take care of memory management with a Garbage Collector during runtime, this comes with performance compromise


  • Make use of Smart Pointers to automate the memory management during runtime
  • However, developers are still able to perform memory management directly. Developers need to follow best practices to minimise the chance of violating memory safety