summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/xmake/os/meminfo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/xmake/os/meminfo.c b/core/src/xmake/os/meminfo.c
index 5fc877831..8189d698a 100644
--- a/core/src/xmake/os/meminfo.c
+++ b/core/src/xmake/os/meminfo.c
@@ -37,6 +37,8 @@
# include <mach-o/nlist.h>
#elif defined(TB_CONFIG_OS_LINUX)
# include <sys/sysinfo.h>
+#elif defined(TB_CONFIG_OS_WINDOWS)
+# include <windows.h>
#endif
/* //////////////////////////////////////////////////////////////////////////////////////
@@ -120,6 +122,15 @@ static tb_bool_t xm_os_meminfo_stats(tb_int_t* ptotalsize, tb_int_t* pavailsize)
return tb_true;
}
}
+#elif defined(TB_CONFIG_OS_WINDOWS)
+ MEMORYSTATUSEX statex;
+ statex.dwLength = sizeof(statex);
+ if (GlobalMemoryStatusEx(&statex))
+ {
+ *ptotalsize = (tb_int_t)(statex.ullTotalPhys / (1024 * 1024));
+ *pavailsize = (tb_int_t)(statex.ullAvailPhys / (1024 * 1024));
+ return tb_true;
+ }
#endif
return tb_false;
}