You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by br...@apache.org on 2024/03/21 04:47:28 UTC
(arrow) 03/03: Uncomment the older code but keep newer bit commented out
This is an automated email from the ASF dual-hosted git repository.
brycemecum pushed a commit to branch exp/memory-pool-bench-threads
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit 850527bf1195c4d8c3291a151b63ac6bcd5bc170
Author: Bryce Mecum <pe...@gmail.com>
AuthorDate: Wed Mar 20 20:35:21 2024 -0800
Uncomment the older code but keep newer bit commented out
---
cpp/src/arrow/memory_pool.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cpp/src/arrow/memory_pool.h b/cpp/src/arrow/memory_pool.h
index 0ffa8a1fc0..df46630125 100644
--- a/cpp/src/arrow/memory_pool.h
+++ b/cpp/src/arrow/memory_pool.h
@@ -48,13 +48,13 @@ class MemoryPoolStats {
int64_t num_allocations() const { return num_allocs_.load(); }
inline void UpdateAllocatedBytes(int64_t diff, bool is_free = false) {
-// auto allocated = bytes_allocated_.fetch_add(diff) + diff;
-// // "maximum" allocated memory is ill-defined in multi-threaded code,
-// // so don't try to be too rigorous here
-// if (diff > 0 && allocated > max_memory_) {
-// max_memory_ = allocated;
-// }
-//
+ auto allocated = bytes_allocated_.fetch_add(diff) + diff;
+ // "maximum" allocated memory is ill-defined in multi-threaded code,
+ // so don't try to be too rigorous here
+ if (diff > 0 && allocated > max_memory_) {
+ max_memory_ = allocated;
+ }
+
// // Reallocations might just expand/contract the allocation in place or might
// // copy to a new location. We can't really know, so we just represent the
// // optimistic case.