Re:Identifying Rust's collect:<Vec<_>>() memory leak footgun
by bobbylarrybobby on Thursday January 18, 2024 @03:36PM
(#39047317)
Box<str> is used pervasively in the rust compiler instead of String for exactly this reason. Basically every string of code the compiler looks at is, unsurprisingly, constant.
[ Parent
| on HN ]
Re:Identifying Rust's collect:<Vec<_>>() memory leak footgun
by steveklabnik on Thursday January 18, 2024 @04:23PM
(#39047957)
Yeah, the general concept here is https://en.wikipedia.org/wiki/String_interning, Box<str> is great for it.