mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
fix(os): total and free memory in bytes (#22247)
This commit is contained in:
parent
961fa27c76
commit
d13094c821
1 changed files with 2 additions and 3 deletions
|
@ -260,7 +260,6 @@ pub fn mem_info() -> Option<MemInfo> {
|
||||||
std::ptr::null_mut(),
|
std::ptr::null_mut(),
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
mem_info.total /= 1024;
|
|
||||||
|
|
||||||
let mut xs: libc::xsw_usage = std::mem::zeroed::<libc::xsw_usage>();
|
let mut xs: libc::xsw_usage = std::mem::zeroed::<libc::xsw_usage>();
|
||||||
mib[0] = libc::CTL_VM;
|
mib[0] = libc::CTL_VM;
|
||||||
|
@ -320,9 +319,9 @@ pub fn mem_info() -> Option<MemInfo> {
|
||||||
let result = sysinfoapi::GlobalMemoryStatusEx(mem_status.as_mut_ptr());
|
let result = sysinfoapi::GlobalMemoryStatusEx(mem_status.as_mut_ptr());
|
||||||
if result != 0 {
|
if result != 0 {
|
||||||
let stat = mem_status.assume_init();
|
let stat = mem_status.assume_init();
|
||||||
mem_info.total = stat.ullTotalPhys / 1024;
|
mem_info.total = stat.ullTotalPhys;
|
||||||
mem_info.available = 0;
|
mem_info.available = 0;
|
||||||
mem_info.free = stat.ullAvailPhys / 1024;
|
mem_info.free = stat.ullAvailPhys;
|
||||||
mem_info.cached = 0;
|
mem_info.cached = 0;
|
||||||
mem_info.buffers = 0;
|
mem_info.buffers = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue