| 95 | } |
| 96 | |
| 97 | void 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 | |
| 118 | void MemoryMonitor::checkResidentMemory() { |
| 119 | auto rss = static_cast<size_t>(facebook::cachelib::util::getRSSBytes()); |
nothing calls this directly
no test coverage detected