The function zmalloc_used_memory can't get the RSS-size of Redis process properly. We can get RSS-size in solaris preperly lik this:
/*
*the struct psiinfo_t is included in the file procfs.h
*/
#include <procfs.h>
#include <string.h>
size_t zmalloc_get_rss(void){
size_t rss = 0;
char filename[256] = {0};
FILE* fp = NULL;
psinfo_t psinfo;
memset((void*)&psinfo,0,sizeof(psinfo));
snprintf(filename,sizeof(filename),"/proc/%ld/psinfo",(long)getpid());
if((fp = fopen(filename,"r")) == NULL)
rss = zmalloc_used_memory();
else
{
if(fread((void*)&psinfo,sizeof(psinfo),1,fp) != 1)
rss = zmalloc_used_memory();
else
rss = psinfo.pr_rssize * 1024;/*pr_size is in Kbytes*/
fclose(fp);
}
return rss;
}
Please fix it.
Comment From: yossigo
Duplicate of #8138