Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c1ef6ffe
Commit
c1ef6ffe
authored
Feb 06, 2012
by
antirez
Browse files
Also remove size of AOF buffers from used memory when doing the math for freeMemoryIfNeeded()
parent
f6b32c14
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
c1ef6ffe
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment