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

Method resizePools

cachelib/allocator/memory/MemoryPoolManager.cpp:200–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200bool MemoryPoolManager::resizePools(PoolId src, PoolId dest, size_t bytes) {
201 auto& srcPool = getPoolById(src);
202 auto& destPool = getPoolById(dest);
203
204 std::unique_lock l(lock_);
205 if (srcPool.getPoolSize() < bytes) {
206 return false;
207 }
208
209 // move the memory.
210 srcPool.resize(srcPool.getPoolSize() - bytes);
211 destPool.resize(destPool.getPoolSize() + bytes);
212 return true;
213}
214
215bool MemoryPoolManager::shrinkPool(PoolId pid, size_t bytes) {
216 auto& pool = getPoolById(pid);

Callers 6

TEST_FFunction · 0.45
TEST_FFunction · 0.45
resize_poolsFunction · 0.45
TYPED_TESTFunction · 0.45

Calls 2

getPoolSizeMethod · 0.80
resizeMethod · 0.45

Tested by 3

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TYPED_TESTFunction · 0.36