-
Notifications
You must be signed in to change notification settings - Fork 352
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 global string de-duplication cache #3470
Comments
(I have updated the issue title and description.) |
There exist many string interning crates, are you leaning towards any specific one? |
None of them are usable I think, since the strings need to be interned in machine memory. This should be just a |
Isn't this also part of a more general gap in allocate_str? For example, certain string constants in rustc const evaluation? Also, though currently I don't think there any current MiriMemoryKind::Machine allocate_str calls where this isn't the case, isn't an additional necessary check for interning these strings that mutability is Mutability::Not? That "seems" obvious to me, but wanted to call it out. |
caller_location strings could also use the cache, yeah. In fact the entire caller_location could be cached, but it's harder to handle that with the same generic infrastructure. And indeed, only immutable strings should be cached. |
Add cache for `allocate_str` Best effort cache for string allocation in const eval. Fixes [rust-lang/miri#3470](rust-lang/miri#3470).
Add cache for `allocate_str` Best effort cache for string allocation in const eval. Fixes [rust-lang/miri#3470](rust-lang/miri#3470).
Add cache for `allocate_str` Best effort cache for string allocation in const eval. Fixes [rust-lang/miri#3470](rust-lang/miri#3470).
Add cache for `allocate_str` Best effort cache for string allocation in const eval. Fixes [rust-lang/miri#3470](rust-lang/miri#3470).
Initially I am thinking of removing the FIXME in Lines 198 to 199 in 052bdcb
But it seems that this FIXME is not resolved yet. If I understand it correctly, rust-lang/rust#127638 only added de-duplication cache for Is it possible to use |
No. We should have |
Currently, in
localtime_r
and also for some cases where we raise panics, we allocate a fresh string each time. These strings never get deallocated so they just keep accumulating. Conceptually these are static strings so we can deduplicate them with a global cache.The cache should be used everywhere that
allocate_str
is called withMiriMemoryKind::Machine
.The text was updated successfully, but these errors were encountered: