aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2023-10-16 18:00:21 +0300
committeralexvru <alexvru@ydb.tech>2023-10-16 18:21:29 +0300
commit2ccfda7458622536129fd3b68e9dfbbe971e36f0 (patch)
treefeb9ef8c1cbc53f3bb5da11d81d2d50636951b47
parentee254664ac9703699434b1a36351cebbcac2f9b0 (diff)
downloadydb-2ccfda7458622536129fd3b68e9dfbbe971e36f0.tar.gz
Fix memory leak in TRopeArena KIKIMR-19632
-rw-r--r--library/cpp/actors/util/rope.h15
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h4
2 files changed, 1 insertions, 18 deletions
diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h
index d1385f6b75..1ab9a1b8ee 100644
--- a/library/cpp/actors/util/rope.h
+++ b/library/cpp/actors/util/rope.h
@@ -915,8 +915,6 @@ class TRopeArena {
TAllocateCallback Allocator;
TRope Arena;
- size_t Size = 0;
- THashSet<const void*> AccountedBuffers;
public:
TRopeArena(TAllocateCallback&& allocator)
@@ -949,16 +947,6 @@ public:
return res;
}
-
- size_t GetSize() const {
- return Size;
- }
-
- void AccountChunk(const TRcBuf& chunk) {
- if (AccountedBuffers.insert(chunk.Backend.UniqueId()).second) {
- Size += chunk.GetOccupiedMemorySize();
- }
- }
};
struct TRopeUtils {
@@ -1131,9 +1119,6 @@ inline TRope TRope::CopySpaceOptimized(TRope&& origin, size_t worstRatioPer1k, T
}
res.Size = origin.Size;
origin = TRope();
- for (const TRcBuf& chunk : res.Chain) {
- arena.AccountChunk(chunk);
- }
return res;
}
diff --git a/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h b/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h
index 00b997edeb..8ea5e2e400 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h
@@ -201,12 +201,10 @@ namespace NKikimr {
inline void TFreshIndexAndData<TKeyLogoBlob, TMemRecLogoBlob>::PutLogoBlobWithData(ui64 lsn,
const TKeyLogoBlob &key, ui8 partId, const TIngress &ingress, TRope buffer) {
TMemRecLogoBlob memRec(ingress);
- const size_t before = Arena->GetSize();
buffer = TRope::CopySpaceOptimized(std::move(buffer), 128, *Arena);
const ui64 fullDataSize = key.LogoBlobID().BlobSize();
+ const size_t delta = buffer.size();
TRope blob = TDiskBlob::Create(fullDataSize, partId, HullCtx->VCtx->Top->GType.TotalPartCount(), std::move(buffer), *Arena);
- const size_t after = Arena->GetSize();
- const size_t delta = after - before;
FreshDataMemConsumer.Add(delta);
const ui32 blobSize = blob.GetSize();