Hi all,
I want to know how much memory does my umap allocates in ram.
I have the following definitions
std::tr1::unordered_map<string, long> umap;
umap h1;

i do some insertions and at the end i want to know how much memory my umap allocates in ram. How can i find this?

thanks for the help!

I suppose you could iterate through the map and sum up the length of all the strings and the number of bytes occupied by all those integers. Then there will be a small overhead the map class needs for each of the nodes.

I suppose you could iterate through the map and sum up the length of all the strings and the number of bytes occupied by all those integers. Then there will be a small overhead the map class needs for each of the nodes.

is not the first argument, string, hashed and the second parameter, int, is left as it is. so i guess string and its hashed value should be different in size. am i thinking in a wrong way?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.