Is there any method to find the amount/size of memory allocated to a map in c++?
There is a function to find the size of the map,ie,number of entries in the map, but is there any such method for the memory.
I have a map ( string, string).
The sizeof() is always giving me a size of 48. Any reason why this is so?
Thanks 🙂
Is there any method to find the amount/size of memory allocated to a map
Share
No, there is not. However you can achieve something similar for classes that support a
.sizemethod such as strings or standard container:If you want to know the allocated memory you could use
.capacity: