summaryrefslogtreecommitdiff
path: root/src/zmalloc.c
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2021-03-09 11:33:32 +0200
committerGitHub <noreply@github.com>2021-03-09 11:33:32 +0200
commitaf2175326c87231d16c5633dd8febbc86a258540 (patch)
treed58fc960970164708539678cdbecf78ace42bb3e /src/zmalloc.c
parent9b4edfdf08a99adda0b6da5b1434d14884d6419b (diff)
downloadredis-af2175326c87231d16c5633dd8febbc86a258540.tar.gz
Fix memory info on FreeBSD. (#8620)
The obtained process_rss was incorrect (the OS reports pages, not bytes), resulting with many other fields getting corrupted. This has been tested on FreeBSD but not other platforms.
Diffstat (limited to 'src/zmalloc.c')
-rw-r--r--src/zmalloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 1dc662e57..e212583a4 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -414,9 +414,9 @@ size_t zmalloc_get_rss(void) {
if (sysctl(mib, 4, &info, &infolen, NULL, 0) == 0)
#if defined(__FreeBSD__)
- return (size_t)info.ki_rssize;
+ return (size_t)info.ki_rssize * getpagesize();
#else
- return (size_t)info.kp_vm_rssize;
+ return (size_t)info.kp_vm_rssize * getpagesize();
#endif
return 0L;
@@ -436,7 +436,7 @@ size_t zmalloc_get_rss(void) {
mib[4] = sizeof(info);
mib[5] = 1;
if (sysctl(mib, 4, &info, &infolen, NULL, 0) == 0)
- return (size_t)info.p_vm_rssize;
+ return (size_t)info.p_vm_rssize * getpagesize();
return 0L;
}