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

Method checkFreeMemory

cachelib/allocator/MemoryMonitor.cpp:97–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void MemoryMonitor::checkFreeMemory() {
98 auto memFree = facebook::cachelib::util::getMemAvailable();
99 memAvailableSize_ = memFree;
100 rateLimiter_.addValue(memFree);
101 const auto stats = cache_.getCacheMemoryStats();
102 if (memFree < lowerLimit_) {
103 XLOGF(DBG,
104 "Free memory size of {} bytes is below the limit of {} bytes",
105 memFree,
106 lowerLimit_);
107 adviseAwaySlabs();
108 } else if (memFree > upperLimit_ && stats.numAdvisedSlabs() > 0) {
109 XLOGF(DBG,
110 "Free memory size of {} bytes is above the limit of {} bytes",
111 memFree,
112 upperLimit_);
113 reclaimSlabs();
114 }
115 checkPoolsAndAdviseReclaim();
116}
117
118void MemoryMonitor::checkResidentMemory() {
119 auto rss = static_cast<size_t>(facebook::cachelib::util::getRSSBytes());

Callers

nothing calls this directly

Calls 4

getMemAvailableFunction · 0.85
addValueMethod · 0.80
numAdvisedSlabsMethod · 0.80
getCacheMemoryStatsMethod · 0.45

Tested by

no test coverage detected