Skip to content

Commit

Permalink
Wrong result of ReservationListenableMemoryPool::Impl::bytes_allocated()
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer authored Aug 27, 2021
1 parent 018f966 commit fa49b55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/src/arrow/jniutil/jni_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,15 @@ class ReservationListenableMemoryPool::Impl {
}
int64_t bytes_granted = (new_block_count - blocks_reserved_) * block_size_;
blocks_reserved_ = new_block_count;
if (bytes_reserved_ > max_bytes_reserved_) {
max_bytes_reserved_ = bytes_reserved_;
}
return bytes_granted;
}

int64_t bytes_allocated() { return pool_->bytes_allocated(); }
int64_t bytes_allocated() const { return bytes_reserved_; }

int64_t max_memory() { return pool_->max_memory(); }
int64_t max_memory() const { return max_bytes_reserved_; }

std::string backend_name() { return pool_->backend_name(); }

Expand All @@ -128,6 +131,7 @@ class ReservationListenableMemoryPool::Impl {
int64_t block_size_;
int64_t blocks_reserved_;
int64_t bytes_reserved_;
int64_t max_bytes_reserved_ = 0L;
std::mutex mutex_;
};

Expand Down

0 comments on commit fa49b55

Please sign in to comment.