Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force INFO used_memory_peak to match peak memory #1572

Merged
merged 1 commit into from Mar 3, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/redis.c
Expand Up @@ -2407,8 +2407,13 @@ sds genRedisInfoString(char *section) {
if (allsections || defsections || !strcasecmp(section,"memory")) { if (allsections || defsections || !strcasecmp(section,"memory")) {
char hmem[64]; char hmem[64];
char peak_hmem[64]; char peak_hmem[64];
size_t zmalloc_used = zmalloc_used_memory();


bytesToHuman(hmem,zmalloc_used_memory()); if (zmalloc_used > server.stat_peak_memory) {
server.stat_peak_memory = zmalloc_used;
}

bytesToHuman(hmem,zmalloc_used);
bytesToHuman(peak_hmem,server.stat_peak_memory); bytesToHuman(peak_hmem,server.stat_peak_memory);
if (sections++) info = sdscat(info,"\r\n"); if (sections++) info = sdscat(info,"\r\n");
info = sdscatprintf(info, info = sdscatprintf(info,
Expand All @@ -2421,7 +2426,7 @@ sds genRedisInfoString(char *section) {
"used_memory_lua:%lld\r\n" "used_memory_lua:%lld\r\n"
"mem_fragmentation_ratio:%.2f\r\n" "mem_fragmentation_ratio:%.2f\r\n"
"mem_allocator:%s\r\n", "mem_allocator:%s\r\n",
zmalloc_used_memory(), zmalloc_used,
hmem, hmem,
zmalloc_get_rss(), zmalloc_get_rss(),
server.stat_peak_memory, server.stat_peak_memory,
Expand Down