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.
This commit is contained in:
parent
9b4edfdf08
commit
af2175326c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user