Memory Management in Rust

Until now, we have always talked about how the Rust compiler handles the memory by itself, and how that makes it memory-safe and gives us some extra superpowers without the fear of creating memory vulnerabilities. Nevertheless, there is no limit to what you can accomplish by using unsafe scopes, and even by using safe code.

We will check all the configuration and metaprogramming options that Rust gives us regarding memory management and see how we can improve our code by using both safe and unsafe code.

In this chapter, we will be looking into the following topics:

  • Learning the rules of the borrow checker
  • Binding lifetimes
  • Memory representation
  • Data representation for FFI with C/C++
  • Shared pointers
  • Reference counted ...

Get Rust High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.