Yesterday i tried to use std::unordered_map
and this code confused me how much memory it used.
typedef list<string> entityId_list;
struct tile_content {
char cost;
entityId_list entities;
};
unordered_map<int, tile_content> hash_map;
for (size_t i = 0; i < 19200; i++) {
tile_content t;
t.cost = 1;
map[i] = t;
}
All this parts of code was compiled in MS VS2010 in debug mode.
What I've been seen in my task manager was about 1200 kb of "clean" process, but after filling hash_map
it uses 8124 kb of memory. Is it normal behavior of unordered_map
? Why so much memory used?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…