@@ -66,11 +66,9 @@ struct TypeHandler<DB, %1%<T0, T1, T2, T3>> {
66
66
"""
67
67
68
68
traversal_func = """
69
- // TODO: This implementation enables the traversal of the container,
70
- // but doesn't report the memory footprint accurately.
71
- // Revisit this implementation and fix memory footprint reporting.
72
69
auto tail = returnArg
73
- .write((uintptr_t)&container)
70
+ .write((uintptr_t)container.getAllocatedMemorySize())
71
+ .write((uintptr_t)container.bucket_count())
74
72
.write(container.size());
75
73
76
74
for (auto &&entry: container) {
@@ -86,16 +84,26 @@ return tail.finish();
86
84
type = " types::st::VarInt<DB>"
87
85
func = " el.pointer = std::get<ParsedData::VarInt>(d.val).value;"
88
86
87
+ [[codegen .processor ]]
88
+ type = " types::st::VarInt<DB>"
89
+ func = """
90
+ el.container_stats.emplace(result::Element::ContainerStats {
91
+ .capacity = std::get<ParsedData::VarInt>(d.val).value,
92
+ });
93
+ """
94
+
89
95
[[codegen .processor ]]
90
96
type = """
91
97
types::st::List<DB, typename TypeHandler<DB, T0>::type>
92
98
"""
93
99
func = """
100
+ auto allocationSize = el.pointer.value();
101
+ el.pointer.reset();
102
+
94
103
auto list = std::get<ParsedData::List>(d.val);
95
- el.container_stats.emplace(result::Element::ContainerStats {
96
- .capacity = list.length,
97
- .length = list.length,
98
- });
104
+ el.container_stats->length = list.length;
105
+
106
+ el.exclusive_size += allocationSize - list.length * sizeof(T0);
99
107
100
108
static constexpr auto childField = make_field<DB, T0>("[]");
101
109
for (size_t i = 0; i < list.length; i++)
0 commit comments