Task is to implement functions to measure the memory consumption of the different parts of the state that we use in the state machine.
This crate seems useful:
https://docs.rs/graphannis-malloc_size_of/latest/graphannis_malloc_size_of/
https://docs.rs/graphannis-malloc_size_of_derive/latest/graphannis_malloc_size_of_derive/
At the top of each crate this is needed so that the macro works:
extern crate graphannis_malloc_size_of as malloc_size_of;
extern crate graphannis_malloc_size_of_derive as malloc_size_of_derive;
And in Cargo.toml:
[dependencies]
graphannis-malloc_size_of = "2.0.0"
graphannis-malloc_size_of_derive = "2.0.0"
Not everything needs to be measured (P2pConfig for example is not important to measure), but anything with a dynamic size (networking and peer state in the p2p crate for example, the snark pool state, transaction pool state, transition frontier state, etc)