object-introspection
object-introspection copied to clipboard
folly::sorted_vector_map is not modelled correctly
By default, folly::sorted_vector_map stores its elements in pairs in a vector, although this is configurable:
class Container = std::vector<std::pair<Key, Value>, Allocator>>
We do not model the underlying container, which means that we do not correctly record the size that it consumes.
e.g.
folly::sorted_vector_map<int8_t, int64_t> map { {1,2}, {3,4} };
To calculate the size of the map, we will only record the size of the individual elements, i.e. sizeof(int8_t) * 2 + sizeof(int64_t) * 2 = 18
.
However, as map entries are stored as std::pair<int8_t, int64_t>
, there will be padding which we are not counting: sizeof(std::pair<int8_t, int64_t>) * 2 = 32