From 55b8f6ec1cde27d84c97f1dbd54ab1077a642c78 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 3 Mar 2014 11:19:54 +0100 Subject: [PATCH] Document why we update peak memory in INFO. --- src/redis.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/redis.c b/src/redis.c index 55f2de16..5560c3c1 100644 --- a/src/redis.c +++ b/src/redis.c @@ -2298,9 +2298,12 @@ sds genRedisInfoString(char *section) { char peak_hmem[64]; size_t zmalloc_used = zmalloc_used_memory(); - if (zmalloc_used > server.stat_peak_memory) { + /* Peak memory is updated from time to time by serverCron() so it + * may happen that the instantaneous value is slightly bigger than + * the peak value. This may confuse users, so we update the peak + * if found smaller than the current memory usage. */ + if (zmalloc_used > server.stat_peak_memory) server.stat_peak_memory = zmalloc_used; - } bytesToHuman(hmem,zmalloc_used); bytesToHuman(peak_hmem,server.stat_peak_memory);