I have a
Vec that contains an arbitrary number of structs, each of which has two strings. I would like to know the total memory consumed. Not just
size_of::<T>() * n, but including both the stack and heap size of
Strings and other relevant structs.
How can I do this? Or is it not worth my effort?
Add up the capacities of the strings and add it to
size_of::<T>() * vec.capacity() + size_of::<Vec<T>>().
Thanks! I thought that would work, but for some reason it just didn't seem right.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.