Skip to content

Expose a method to return the memory usage of all dynamic atoms. #294

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jdm
Copy link
Member

@jdm jdm commented May 20, 2025

We need to perform a manual calculation because https://github.com/bholley/malloc_size_of_derive/ does not contain a MallocSizeOf implementation for [...].

Comment on lines +10 to +11
use malloc_size_of_derive::MallocSizeOf;
use malloc_size_of::{MallocSizeOf as _, MallocSizeOfOps, MallocShallowSizeOf};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports need to be cfgd behind the feature flag

@@ -21,11 +21,13 @@ name = "string_cache"
[features]
serde_support = ["serde"]
default = ["serde_support"]
malloc_size_of = ["dep:malloc_size_of", "malloc_size_of_derive"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants