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

The heap

The heap is for the more complicated and versatile memory allocation schemes. Values in the heap live more dynamically. Memory in the heap is allocated at some point of the program, released at some other point, and there does not have to be a strict boundary between these points like with the stack. In other words, values in the heap may live beyond a function where it was allocated but values in the stack may not.

Note that there is a tree-like data structure that is called the heap, but the heap related to programming language implementations is not the same. Rather, the heap we're talking about now is just a general term for a dynamically allocated pool of memory used in programming languages, and its design can vary.

Rust's ...

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