| 116 | } |
| 117 | |
| 118 | void MemoryMonitor::checkResidentMemory() { |
| 119 | auto rss = static_cast<size_t>(facebook::cachelib::util::getRSSBytes()); |
| 120 | memRssSize_ = rss; |
| 121 | rateLimiter_.addValue(rss); |
| 122 | const auto stats = cache_.getCacheMemoryStats(); |
| 123 | if (rss > upperLimit_) { |
| 124 | XLOGF(DBG, |
| 125 | "Resident memory size of {} bytes is above the limit of {} bytes", |
| 126 | rss, |
| 127 | upperLimit_); |
| 128 | adviseAwaySlabs(); |
| 129 | } else if (rss < lowerLimit_ && stats.numAdvisedSlabs() > 0) { |
| 130 | XLOGF(DBG, |
| 131 | "Resident memory size of {} bytes is below the limit of {} bytes", |
| 132 | rss, |
| 133 | lowerLimit_); |
| 134 | reclaimSlabs(); |
| 135 | } |
| 136 | checkPoolsAndAdviseReclaim(); |
| 137 | } |
| 138 | |
| 139 | namespace { |
| 140 | size_t bytesToSlabs(size_t bytes) { return bytes / Slab::kSize; } |
nothing calls this directly
no test coverage detected