Skip to content

Commit

Permalink
Rename addRootPool maxCapacity parameter (#8673)
Browse files Browse the repository at this point in the history
Summary:
MemoryManager::addRootPool would set the `maxCapacity` of
the root pool, it would be more readable to change the related
parameter from `capacity` to `maxCapacity`.

Pull Request resolved: facebookincubator/velox#8673

Reviewed By: bikramSingh91

Differential Revision: D54301735

Pulled By: xiaoxmeng

fbshipit-source-id: c811cf7317e5b4eae7ae7449193882c8b1d94698
  • Loading branch information
duanmeng authored and facebook-github-bot committed Feb 28, 2024
1 parent c155ce9 commit ec1e5cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions velox/common/memory/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ uint16_t MemoryManager::alignment() const {

std::shared_ptr<MemoryPool> MemoryManager::addRootPool(
const std::string& name,
int64_t capacity,
int64_t maxCapacity,
std::unique_ptr<MemoryReclaimer> reclaimer) {
std::string poolName = name;
if (poolName.empty()) {
Expand All @@ -185,7 +185,7 @@ std::shared_ptr<MemoryPool> MemoryManager::addRootPool(

MemoryPool::Options options;
options.alignment = alignment_;
options.maxCapacity = capacity;
options.maxCapacity = maxCapacity;
options.trackUsage = true;
options.debugEnabled = debugEnabled_;
options.coreOnAllocationFailureEnabled = coreOnAllocationFailureEnabled_;
Expand All @@ -206,7 +206,7 @@ std::shared_ptr<MemoryPool> MemoryManager::addRootPool(
pools_.emplace(poolName, pool);
VELOX_CHECK_EQ(pool->capacity(), 0);
arbitrator_->growCapacity(
pool.get(), std::min<uint64_t>(poolInitCapacity_, capacity));
pool.get(), std::min<uint64_t>(poolInitCapacity_, maxCapacity));
return pool;
}

Expand Down
8 changes: 4 additions & 4 deletions velox/common/memory/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ class MemoryManager {
/// Returns the memory allocation alignment of this memory manager.
uint16_t alignment() const;

/// Creates a root memory pool with specified 'name' and 'capacity'. If 'name'
/// is missing, the memory manager generates a default name internally to
/// ensure uniqueness.
/// Creates a root memory pool with specified 'name' and 'maxCapacity'. If
/// 'name' is missing, the memory manager generates a default name internally
/// to ensure uniqueness.
std::shared_ptr<MemoryPool> addRootPool(
const std::string& name = "",
int64_t capacity = kMaxMemory,
int64_t maxCapacity = kMaxMemory,
std::unique_ptr<MemoryReclaimer> reclaimer = nullptr);

/// Creates a leaf memory pool for direct memory allocation use with specified
Expand Down
4 changes: 2 additions & 2 deletions velox/docs/develop/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ Memory Pool Management

.. code-block:: c++

/// Creates a root memory pool with specified 'name' and 'capacity'.
/// Creates a root memory pool with specified 'name' and 'maxCapacity'.
/// 'reclaimer' is provided for memory arbitration process.
std::shared_ptr<MemoryPool> MemoryManager::addRootPool(
const std::string& name = "",
int64_t capacity = kMaxMemory,
int64_t maxCapacity = kMaxMemory,
std::unique_ptr<MemoryReclaimer> reclaimer = nullptr);

/// Create an aggregate child memory pool which allows to create child memory
Expand Down

0 comments on commit ec1e5cd

Please sign in to comment.