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

Method checkResidentMemory

cachelib/allocator/MemoryMonitor.cpp:118–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void 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
139namespace {
140size_t bytesToSlabs(size_t bytes) { return bytes / Slab::kSize; }

Callers

nothing calls this directly

Calls 4

getRSSBytesFunction · 0.85
addValueMethod · 0.80
numAdvisedSlabsMethod · 0.80
getCacheMemoryStatsMethod · 0.45

Tested by

no test coverage detected