Skip to content

Commit 5a685f3

Browse files
committed
Add maxmemory limit to INFO MEMORY
Since we have the eviction policy, we should have the memory limit too.
1 parent 6741bb9 commit 5a685f3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/redis.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,6 +2702,7 @@ sds genRedisInfoString(char *section) {
27022702
char total_system_hmem[64];
27032703
char used_memory_lua_hmem[64];
27042704
char used_memory_rss_hmem[64];
2705+
char maxmemory_hmem[64];
27052706
size_t zmalloc_used = zmalloc_used_memory();
27062707
size_t total_system_mem = server.system_memory_size;
27072708
char *evict_policy = maxmemoryToString();
@@ -2719,6 +2720,7 @@ sds genRedisInfoString(char *section) {
27192720
bytesToHuman(total_system_hmem,total_system_mem);
27202721
bytesToHuman(used_memory_lua_hmem,memory_lua);
27212722
bytesToHuman(used_memory_rss_hmem,server.resident_set_size);
2723+
bytesToHuman(maxmemory_hmem,server.maxmemory);
27222724

27232725
if (sections++) info = sdscat(info,"\r\n");
27242726
info = sdscatprintf(info,
@@ -2733,9 +2735,11 @@ sds genRedisInfoString(char *section) {
27332735
"total_system_memory_human:%s\r\n"
27342736
"used_memory_lua:%lld\r\n"
27352737
"used_memory_lua_human:%s\r\n"
2738+
"maxmemory:%lld\r\n"
2739+
"maxmemory_human:%s\r\n"
2740+
"maxmemory_policy:%s\r\n"
27362741
"mem_fragmentation_ratio:%.2f\r\n"
2737-
"mem_allocator:%s\r\n"
2738-
"maxmemory_policy:%s\r\n",
2742+
"mem_allocator:%s\r\n",
27392743
zmalloc_used,
27402744
hmem,
27412745
server.resident_set_size,
@@ -2746,9 +2750,11 @@ sds genRedisInfoString(char *section) {
27462750
total_system_hmem,
27472751
memory_lua,
27482752
used_memory_lua_hmem,
2753+
server.maxmemory,
2754+
maxmemory_hmem,
2755+
evict_policy,
27492756
zmalloc_get_fragmentation_ratio(server.resident_set_size),
2750-
ZMALLOC_LIB,
2751-
evict_policy
2757+
ZMALLOC_LIB
27522758
);
27532759
}
27542760

0 commit comments

Comments
 (0)