summaryrefslogtreecommitdiff
path: root/xmake/core/base/memory.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-27 23:02:12 +0800
committerruki <[email protected]>2022-07-27 23:02:12 +0800
commitbbf97386cc97ce835b09462e46b0d097aedb92fc (patch)
treed7d602a37ae6aaa8fddb202f70c1dd7480049299 /xmake/core/base/memory.lua
parent557b2bf7b8326ecc440db1d67617bc8bae62959d (diff)
improve meminfo for macos
Diffstat (limited to 'xmake/core/base/memory.lua')
-rw-r--r--xmake/core/base/memory.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/xmake/core/base/memory.lua b/xmake/core/base/memory.lua
index da6f4b1af..5545e8c08 100644
--- a/xmake/core/base/memory.lua
+++ b/xmake/core/base/memory.lua
@@ -27,6 +27,9 @@ local os = require("base/os")
-- get memory info
function memory.info(name)
local meminfo = os._meminfo()
+ if meminfo.vm_totalsize and meminfo.vm_availsize then
+ meminfo.vm_usagerate = (meminfo.vm_totalsize - meminfo.vm_availsize) / meminfo.vm_totalsize
+ end
return name and meminfo[name] or meminfo
end