MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / updateMaxmemory

Function updateMaxmemory

src/config.cpp:2587–2598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2585}
2586
2587static int updateMaxmemory(long long val, long long prev, const char **err) {
2588 UNUSED(prev);
2589 UNUSED(err);
2590 if (val) {
2591 size_t used = zmalloc_used_memory()-freeMemoryGetNotCountedMemory();
2592 if ((unsigned long long)val < used) {
2593 serverLog(LL_WARNING,"WARNING: the new maxmemory value set via CONFIG SET (%llu) is smaller than the current memory usage (%zu). This will result in key eviction and/or the inability to accept new write commands depending on the maxmemory-policy.", g_pserver->maxmemory, used);
2594 }
2595 performEvictions(false /*fPreSnapshot*/);
2596 }
2597 return 1;
2598}
2599
2600static int updateFlashMaxmemory(long long val, long long prev, const char **err) {
2601 UNUSED(prev);

Callers

nothing calls this directly

Calls 4

zmalloc_used_memoryFunction · 0.85
serverLogFunction · 0.85
performEvictionsFunction · 0.85

Tested by

no test coverage detected