MCPcopy Create free account
hub / github.com/F-Stack/f-stack / freeMemoryGetNotCountedMemory

Function freeMemoryGetNotCountedMemory

app/redis-6.2.6/src/evict.c:330–348  ·  view source on GitHub ↗

We don't want to count AOF buffers and slaves output buffers as * used memory: the eviction should use mostly data size. This function * returns the sum of AOF and slaves buffer. */

Source from the content-addressed store, hash-verified

328 * used memory: the eviction should use mostly data size. This function
329 * returns the sum of AOF and slaves buffer. */
330size_t freeMemoryGetNotCountedMemory(void) {
331 size_t overhead = 0;
332 int slaves = listLength(server.slaves);
333
334 if (slaves) {
335 listIter li;
336 listNode *ln;
337
338 listRewind(server.slaves,&li);
339 while((ln = listNext(&li))) {
340 client *slave = listNodeValue(ln);
341 overhead += getClientOutputBufferMemoryUsage(slave);
342 }
343 }
344 if (server.aof_state != AOF_OFF) {
345 overhead += sdsalloc(server.aof_buf)+aofRewriteBufferSize();
346 }
347 return overhead;
348}
349
350/* Get the memory status from the point of view of the maxmemory directive:
351 * if the memory used is under the maxmemory setting then C_OK is returned.

Callers 4

updateMaxmemoryFunction · 0.85
getMaxmemoryStateFunction · 0.85
overMaxmemoryAfterAllocFunction · 0.85
genRedisInfoStringFunction · 0.85

Calls 5

listRewindFunction · 0.85
listNextFunction · 0.85
sdsallocFunction · 0.85
aofRewriteBufferSizeFunction · 0.85

Tested by

no test coverage detected