After compiling a schema I would like to know how much dynamic memory is in use by the Rust SchemaNode (and any children such as Vec) struct. This would be useful for cache eviction scenarios where the cache wants to use total memory size to decide when to start evicting jsonschema-rs compiled schemas.
I don't believe static analysis functions (such as std::mem::size_of) are useful here since lower down a string pattern validator would need to know the length of the pattern and complexity to calculate the dynamic memory of the compiled pattern.
I have tried to use dynamic analysis crates/functions such as get_size and memuse but jsonschema-rs does not seem to support the correct traits to enable my programs to compile.
After compiling a schema I would like to know how much dynamic memory is in use by the Rust SchemaNode (and any children such as Vec) struct. This would be useful for cache eviction scenarios where the cache wants to use total memory size to decide when to start evicting jsonschema-rs compiled schemas.
I don't believe static analysis functions (such as
std::mem::size_of) are useful here since lower down a string pattern validator would need to know the length of the pattern and complexity to calculate the dynamic memory of the compiled pattern.I have tried to use dynamic analysis crates/functions such as
get_sizeandmemusebut jsonschema-rs does not seem to support the correct traits to enable my programs to compile.