提交 c1ef6ffe 编写于 作者: A antirez

Also remove size of AOF buffers from used memory when doing the math for freeMemoryIfNeeded()

上级 f6b32c14
......@@ -1802,8 +1802,8 @@ int freeMemoryIfNeeded(void) {
size_t mem_used, mem_tofree, mem_freed;
int slaves = listLength(server.slaves);
/* Remove the size of slaves output buffers from the count of used
* memory. */
/* Remove the size of slaves output buffers and AOF buffer from the
* count of used memory. */
mem_used = zmalloc_used_memory();
if (slaves) {
listIter li;
......@@ -1819,6 +1819,10 @@ int freeMemoryIfNeeded(void) {
mem_used -= obuf_bytes;
}
}
if (server.aof_state != REDIS_AOF_OFF) {
mem_used -= sdslen(server.aof_buf);
mem_used -= sdslen(server.aof_rewrite_buf);
}
/* Check if we are over the memory limit. */
if (mem_used <= server.maxmemory) return REDIS_OK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册