mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
maxmemory fixed, we now try to release memory just before we check for the memory limit. Before fixing there was code between the attempt to free memory and the check for memory limits, and this code could result into allocations going again after the memory limit.
This commit is contained in:
parent
144a5e72f2
commit
1dd10ca233
10
src/redis.c
10
src/redis.c
@ -889,9 +889,6 @@ void call(redisClient *c, struct redisCommand *cmd) {
|
||||
int processCommand(redisClient *c) {
|
||||
struct redisCommand *cmd;
|
||||
|
||||
/* Free some memory if needed (maxmemory setting) */
|
||||
if (server.maxmemory) freeMemoryIfNeeded();
|
||||
|
||||
/* Handle the multi bulk command type. This is an alternative protocol
|
||||
* supported by Redis in order to receive commands that are composed of
|
||||
* multiple binary-safe "bulk" arguments. The latency of processing is
|
||||
@ -1029,7 +1026,12 @@ int processCommand(redisClient *c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Handle the maxmemory directive */
|
||||
/* Handle the maxmemory directive.
|
||||
*
|
||||
* First we try to free some memory if possible (if there are volatile
|
||||
* keys in the dataset). If there are not the only thing we can do
|
||||
* is returning an error. */
|
||||
if (server.maxmemory) freeMemoryIfNeeded();
|
||||
if (server.maxmemory && (cmd->flags & REDIS_CMD_DENYOOM) &&
|
||||
zmalloc_used_memory() > server.maxmemory)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user