Closed MeirShpilraien closed 2 years ago
This is not really possible as some memory is intentionally shared between different IValue
s (such as via IString
which is interned).
The way I do this for the comparison script is that I install a custom allocator which tracks memory usage for the whole application. You could try a similar thing.
If you just want a very rough approximation, you could recursively iterate the IValue
and give each type a "cost" function, but this isn't something I want to add to the crate.
Hey, I would like to know (at runtime), for a given IValue, what is the memory usage it consumes. Any recommended way to do it? Is it something that makes sense to add to the API? Thanks.