mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
fix: refund loaded resource usage in Insert/DeleteRecord destructor (#44555)
issue: #44528 Signed-off-by: Shawn Wang <shawn.wang@zilliz.com>
This commit is contained in:
parent
eac16a577c
commit
0145dc8c06
@ -67,8 +67,11 @@ class DeletedRecord {
|
||||
|
||||
~DeletedRecord() {
|
||||
if constexpr (is_sealed) {
|
||||
cachinglayer::Manager::GetInstance().RefundLoadedResource(
|
||||
{estimated_memory_size_, 0});
|
||||
if (estimated_memory_size_ > 0) {
|
||||
cachinglayer::Manager::GetInstance().RefundLoadedResource(
|
||||
{estimated_memory_size_, 0});
|
||||
estimated_memory_size_ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -461,6 +461,14 @@ class InsertRecordSealed {
|
||||
}
|
||||
}
|
||||
|
||||
~InsertRecordSealed() {
|
||||
if (estimated_memory_size_ > 0) {
|
||||
cachinglayer::Manager::GetInstance().RefundLoadedResource(
|
||||
{static_cast<int64_t>(estimated_memory_size_), 0});
|
||||
estimated_memory_size_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
contain(const PkType& pk) const {
|
||||
return pk2offset_->contain(pk);
|
||||
@ -587,9 +595,11 @@ class InsertRecordSealed {
|
||||
timestamp_index_ = TimestampIndex();
|
||||
pk2offset_->clear();
|
||||
reserved = 0;
|
||||
cachinglayer::Manager::GetInstance().RefundLoadedResource(
|
||||
{static_cast<int64_t>(estimated_memory_size_), 0});
|
||||
estimated_memory_size_ = 0;
|
||||
if (estimated_memory_size_ > 0) {
|
||||
cachinglayer::Manager::GetInstance().RefundLoadedResource(
|
||||
{static_cast<int64_t>(estimated_memory_size_), 0});
|
||||
estimated_memory_size_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user