Expose a method to return the memory usage of all dynamic atoms.#294
Open
Expose a method to return the memory usage of all dynamic atoms.#294
Conversation
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
nicoburns
requested changes
May 20, 2025
Comment on lines
+10
to
+11
| use malloc_size_of_derive::MallocSizeOf; | ||
| use malloc_size_of::{MallocSizeOf as _, MallocSizeOfOps, MallocShallowSizeOf}; |
Contributor
There was a problem hiding this comment.
These imports need to be cfgd behind the feature flag
| [features] | ||
| serde_support = ["serde"] | ||
| default = ["serde_support"] | ||
| malloc_size_of = ["dep:malloc_size_of", "malloc_size_of_derive"] |
Contributor
There was a problem hiding this comment.
Use of dep: syntax requires Rust 1.71, so we should bump the rust-version if we're going to do this. I think this should be fine for string_cache? But perhaps worth noting I had to revert to the older feature syntax for crates like euclid that have lower MSRVs.
| } | ||
| } | ||
|
|
||
| #[cfg_attr(feature = "malloc_size_of", derive(MallocSizeOf))] |
Contributor
There was a problem hiding this comment.
I would personally be tempted to do a manual impl here to avoid the dep on the derive crate (but I suspect my opinion will be a minority one here so this is more of a "noted dissenting opinion" rather than a request for a change).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We need to perform a manual calculation because https://github.com/bholley/malloc_size_of_derive/ does not contain a MallocSizeOf implementation for
[...].