trim the double implementation of jemalloc purge
This commit is contained in:
parent
bf759cc9c3
commit
0f1969f16f
16
src/object.c
16
src/object.c
@ -1450,22 +1450,10 @@ NULL
|
|||||||
addReplyVerbatim(c,report,sdslen(report),"txt");
|
addReplyVerbatim(c,report,sdslen(report),"txt");
|
||||||
sdsfree(report);
|
sdsfree(report);
|
||||||
} else if (!strcasecmp(c->argv[1]->ptr,"purge") && c->argc == 2) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"purge") && c->argc == 2) {
|
||||||
#if defined(USE_JEMALLOC)
|
if (jemalloc_purge() == 0)
|
||||||
char tmp[32];
|
|
||||||
unsigned narenas = 0;
|
|
||||||
size_t sz = sizeof(unsigned);
|
|
||||||
if (!je_mallctl("arenas.narenas", &narenas, &sz, NULL, 0)) {
|
|
||||||
sprintf(tmp, "arena.%d.purge", narenas);
|
|
||||||
if (!je_mallctl(tmp, NULL, 0, NULL, 0)) {
|
|
||||||
addReply(c, shared.ok);
|
addReply(c, shared.ok);
|
||||||
return;
|
else
|
||||||
}
|
|
||||||
}
|
|
||||||
addReplyError(c, "Error purging dirty pages");
|
addReplyError(c, "Error purging dirty pages");
|
||||||
#else
|
|
||||||
addReply(c, shared.ok);
|
|
||||||
/* Nothing to do for other allocators. */
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try MEMORY HELP", (char*)c->argv[1]->ptr);
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try MEMORY HELP", (char*)c->argv[1]->ptr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user