We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b650a3 commit 13721a4Copy full SHA for 13721a4
+stdlib/+sys/ram_free.m
@@ -5,14 +5,18 @@
5
if ispc()
6
cmd = 'pwsh -c "(Get-CimInstance -ClassName CIM_OperatingSystem).FreePhysicalMemory * 1KB"';
7
elseif ismac()
8
- cmd = 'sysctl -n hw.memsize';
+ cmd = 'sysctl -n vm.page_free_count';
9
else
10
cmd = "free -b | awk '/Mem:/ {print $4}'";
11
end
12
13
[s, m] = system(cmd);
14
if s == 0
15
bytes = str2double(m);
16
+ if ismac()
17
+ bytes = bytes * 4096; % Assuming a page size of 4096 bytes
18
+ end
19
+
20
21
22
bytes = uint64(bytes);
+stdlib/+sys/ram_total.m
@@ -7,7 +7,7 @@
cmd = 'sysctl -n hw.memsize';
- cmd = "free -b | awk '/Mem:/ {print $4}'";
+ cmd = "free -b | awk '/Mem:/ {print $2}'";
0 commit comments