Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links for arena and interning. #1868

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Rustc tries to be pretty careful how it manages memory. The compiler allocates
_a lot_ of data structures throughout compilation, and if we are not careful,
it will take a lot of time and space to do so.

One of the main way the compiler manages this is using arenas and interning.
One of the main way the compiler manages this is using [arena]s and [interning].

[arena]: https://en.wikipedia.org/wiki/Region-based_memory_management
[interning]: https://en.wikipedia.org/wiki/String_interning

## Arenas and Interning

Expand Down
15 changes: 9 additions & 6 deletions src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,15 @@ for different purposes:
optimizations on it.

One other thing to note is that many values in the compiler are _interned_.
This is a performance and memory optimization in which we allocate the values
in a special allocator called an _arena_. Then, we pass around references to
the values allocated in the arena. This allows us to make sure that identical
values (e.g. types in your program) are only allocated once and can be compared
cheaply by comparing pointers. Many of the intermediate representations are
interned.
This is a performance and memory optimization in which we allocate the values in
a special allocator called an
_[arena]_. Then, we pass
around references to the values allocated in the arena. This allows us to make
sure that identical values (e.g. types in your program) are only allocated once
and can be compared cheaply by comparing pointers. Many of the intermediate
representations are interned.

[arena]: https://en.wikipedia.org/wiki/Region-based_memory_management

### Queries

Expand Down