Skip to content

Commit 9f9c9d2

Browse files
Add links for arena and interning. (#1868)
Co-authored-by: Yuki Okushi <[email protected]>
1 parent 11aa615 commit 9f9c9d2

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Diff for: src/memory.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ Rustc tries to be pretty careful how it manages memory. The compiler allocates
44
_a lot_ of data structures throughout compilation, and if we are not careful,
55
it will take a lot of time and space to do so.
66

7-
One of the main way the compiler manages this is using arenas and interning.
7+
One of the main way the compiler manages this is using [arena]s and [interning].
8+
9+
[arena]: https://en.wikipedia.org/wiki/Region-based_memory_management
10+
[interning]: https://en.wikipedia.org/wiki/String_interning
811

912
## Arenas and Interning
1013

Diff for: src/overview.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,15 @@ for different purposes:
246246
optimizations on it.
247247

248248
One other thing to note is that many values in the compiler are _interned_.
249-
This is a performance and memory optimization in which we allocate the values
250-
in a special allocator called an _arena_. Then, we pass around references to
251-
the values allocated in the arena. This allows us to make sure that identical
252-
values (e.g. types in your program) are only allocated once and can be compared
253-
cheaply by comparing pointers. Many of the intermediate representations are
254-
interned.
249+
This is a performance and memory optimization in which we allocate the values in
250+
a special allocator called an
251+
_[arena]_. Then, we pass
252+
around references to the values allocated in the arena. This allows us to make
253+
sure that identical values (e.g. types in your program) are only allocated once
254+
and can be compared cheaply by comparing pointers. Many of the intermediate
255+
representations are interned.
256+
257+
[arena]: https://en.wikipedia.org/wiki/Region-based_memory_management
255258

256259
### Queries
257260

0 commit comments

Comments
 (0)