MCPcopy Create free account
hub / github.com/facebook/CacheLib / shrinkPool

Method shrinkPool

cachelib/allocator/memory/MemoryPoolManager.cpp:215–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215bool MemoryPoolManager::shrinkPool(PoolId pid, size_t bytes) {
216 auto& pool = getPoolById(pid);
217
218 std::unique_lock l(lock_);
219 if (pool.getPoolSize() < bytes) {
220 return false;
221 }
222 pool.resize(pool.getPoolSize() - bytes);
223 return true;
224}
225
226bool MemoryPoolManager::growPool(PoolId pid, size_t bytes) {
227 auto& pool = getPoolById(pid);

Callers 10

TEST_FFunction · 0.45
TEST_FFunction · 0.45
testShrinkWithFreeMemMethod · 0.45
testGrowWithFreeMemMethod · 0.45
shrink_poolFunction · 0.45
TYPED_TESTFunction · 0.45

Calls 2

getPoolSizeMethod · 0.80
resizeMethod · 0.45

Tested by 9

TEST_FFunction · 0.36
TEST_FFunction · 0.36
testShrinkWithFreeMemMethod · 0.36
testGrowWithFreeMemMethod · 0.36
TYPED_TESTFunction · 0.36