diff options
author | Daniil Cherednik <dcherednik@ydb.tech> | 2023-08-25 09:14:00 +0000 |
---|---|---|
committer | Daniil Cherednik <dcherednik@ydb.tech> | 2023-08-25 09:14:00 +0000 |
commit | 1aea989538126dcf9bb99aa87313ba942e679e7b (patch) | |
tree | 5f89fae597bbf8cfaf58c56fd2313d1896a956bb /library/cpp/actors/util/rope.cpp | |
parent | 41effae1b14cbd91927d4d7746c935f773ee87ef (diff) | |
download | ydb-1aea989538126dcf9bb99aa87313ba942e679e7b.tar.gz |
Create stable-23-3 branch
x-stable-origin-commit: 3224c68a1e19d5457dc64c1c4f3260f7cd718558
Diffstat (limited to 'library/cpp/actors/util/rope.cpp')
-rw-r--r-- | library/cpp/actors/util/rope.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/cpp/actors/util/rope.cpp b/library/cpp/actors/util/rope.cpp new file mode 100644 index 0000000000..0927774099 --- /dev/null +++ b/library/cpp/actors/util/rope.cpp @@ -0,0 +1,13 @@ +#include "rope.h" +#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h> + +size_t TRope::GetOccupiedMemorySize() const { + size_t res = 0; + absl::flat_hash_set<const void*> chunks; + for (const auto& chunk : Chain) { + if (const auto [it, inserted] = chunks.insert(chunk.Backend.UniqueId()); inserted) { + res += chunk.Backend.GetOccupiedMemorySize(); + } + } + return res; +} |