Skip to content

Commit e0af7b4

Browse files
author
don-dron
committed
YT-22619: Improve merge job memory tracking
38867a055f64fbf74a008e2c1dd1ef1cda73736d
1 parent 6494b88 commit e0af7b4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

yt/yt/core/misc/collection_helpers-inl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ const T& VectorAtOr(const std::vector<T>& vector, ssize_t index, const T& defaul
350350
return index < std::ssize(vector) ? vector[index] : defaultValue;
351351
}
352352

353+
template <class T>
354+
i64 GetVectorMemoryUsage(const std::vector<T>& vector)
355+
{
356+
return vector.capacity() * sizeof(T);
357+
}
358+
353359
////////////////////////////////////////////////////////////////////////////////
354360

355361
} // namespace NYT

yt/yt/core/misc/collection_helpers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ void AssignVectorAt(std::vector<T>& vector, ssize_t index, T&& value, const T& d
154154
template <class T>
155155
const T& VectorAtOr(const std::vector<T>& vector, ssize_t index, const T& defaultValue = T());
156156

157+
template <class T>
158+
i64 GetVectorMemoryUsage(const std::vector<T>& vector);
159+
157160
////////////////////////////////////////////////////////////////////////////////
158161

159162
} // namespace NYT

0 commit comments

Comments
 (0)