Skip to content

Cannot get dynamic runtime memory usage of a compiled schema Rust struct #928

@yahelnachum

Description

@yahelnachum

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions