X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/120ba3922d88fdf184f167b4a1bcb69ed5e18720..4d9bd5353027561039dc4583c794c8cfec30202c:/src/config.c diff --git a/src/config.c b/src/config.c index 768db1e9..a36eb9a3 100644 --- a/src/config.c +++ b/src/config.c @@ -438,7 +438,12 @@ void configSetCommand(redisClient *c) { if (getLongLongFromObject(o,&ll) == REDIS_ERR || ll < 0) goto badfmt; server.maxmemory = ll; - if (server.maxmemory) freeMemoryIfNeeded(); + if (server.maxmemory) { + if (server.maxmemory < zmalloc_used_memory()) { + redisLog(REDIS_WARNING,"WARNING: the new maxmemory value set via CONFIG SET is smaller than the current memory usage. This will result in keys eviction and/or inability to accept new write commands depending on the maxmemory-policy."); + } + freeMemoryIfNeeded(); + } } else if (!strcasecmp(c->argv[2]->ptr,"maxmemory-policy")) { if (!strcasecmp(o->ptr,"volatile-lru")) { server.maxmemory_policy = REDIS_MAXMEMORY_VOLATILE_LRU;