summaryrefslogtreecommitdiff
path: root/src/evict.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-04-09 17:20:36 +0200
committerantirez <antirez@gmail.com>2018-04-09 17:20:36 +0200
commit6888c1a10d085365ce32e9b09f9fd8d54672e1e7 (patch)
tree9c35836289a09f6fed1ab2190737bcccc98451cb /src/evict.c
parent9a0dbbb594f74e27c9d8f550c494501b0196aed6 (diff)
downloadredis-6888c1a10d085365ce32e9b09f9fd8d54672e1e7.tar.gz
freeMemoryIfNeeded() lacked a top comment.
Diffstat (limited to 'src/evict.c')
-rw-r--r--src/evict.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/evict.c b/src/evict.c
index bf485ddc5..063cf03d1 100644
--- a/src/evict.c
+++ b/src/evict.c
@@ -369,6 +369,15 @@ size_t freeMemoryGetNotCountedMemory(void) {
return overhead;
}
+/* This function is periodically called to see if there is memory to free
+ * according to the current "maxmemory" settings. In case we are over the
+ * memory limit, the function will try to free some memory to return back
+ * under the limit.
+ *
+ * The function returns C_OK if we are under the memory limit or if we
+ * were over the limit, but the attempt to free memory was successful.
+ * Otehrwise if we are over the memory limit, but not enough memory
+ * was freed to return back under the limit, the function returns C_ERR. */
int freeMemoryIfNeeded(void) {
size_t mem_reported, mem_used, mem_tofree, mem_freed;
mstime_t latency, eviction_latency;