As a follow-up question to the one posted yesterday, Memory consumption of a pointer to vector of pointers, I have another question concerning memory usage of a boost ptr_map with key type being, say a class A (assume int for now) and value being a (pointer to) vector of pointers of some type (assume int again), this being a ptr_map. I have read in the question, How can i estimate memory usage of std::map? that the memory consumption for STL maps is generally
(sizeof(A) + sizeof(B) + ELEMENT_OVERHEAD) * N + CONTAINER_OVERHEAD
My question concerns how big can element overhead be for such a design, in relation to
sizeof(A) + sizeof(B)
Assuming the types A and B (A here was assumed int, and B a pointer to vector of pointers to int), even an answer for usual STL maps would be of some help, I suppose. Also, I would like to know if possible, how/whether things change if A is more complex..I guess element overhead grows also with the complexity of A? Is the element overhead bounded by some fraction of the sum of sizes of A and B? My concern is that if the element overhead is a big fraction that is not really bounded, the entire point of using maps doesn't seem appealing any more.