O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Memory, Lifetimes, and Borrowing

Rust makes you, the developer, handle memory yourself. It helps you along the way, however, by having abstractions and language support for memory allocations. Its system of lifetimes, ownership, and borrowing may be familiar to you as concepts from the C++ world. Rust has all of these, not just as concepts but in the language along with compile-time checking, making this most difficult class of runtime problems an easier compile-time problem.

This chapter goes into the details of memory management in Rust. We give a short introduction to LLVM, the compiler framework that the Rust compiler uses, and its Intermediate Representation code.

The topics covered in this chapter are:

  • LLVM
  • Function variables, stack ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required