-
Notifications
You must be signed in to change notification settings - Fork 18
Add differential memory usage tracking #51
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
Conversation
|
||
pub trait MemorySize { | ||
/// The memory address of this item. | ||
fn self_pointer(&self) -> usize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We found a bug on the MemorySize
impl for BeaconState
where we were returning the &BeaconState
from self_pointer
. This meant that mutating a beacon state without cloning it would cause the memory tracker to skip over the state when provided a second time, because it thought the pointer had already been seen.
We should probably make sure that pointers returned by self_pointer
are immutable, i.e. the address uniquely determines the contents at that address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried using Arc
, but ran into issues with test because of wrapping impl List
in Arc
. Will look into it as I keep working on Lighthouse#7449
Implement a much-thought-about feature to track the differential size of multiple data structures stored using structural sharing!