Skip to content

Commit 4b70d1b

Browse files
committed
ram_total proper fallback
1 parent 215ba48 commit 4b70d1b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

+stdlib/ram_total.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
function bytes = ram_total()
1111

1212
% .NET is about 10 times SLOWER than Java
13-
% if ispc() && ~stdlib.isoctave()
14-
% h = NET.addAssembly('Microsoft.VisualBasic');
15-
% ci = Microsoft.VisualBasic.Devices.ComputerInfo();
16-
% bytes = ci.TotalPhysicalMemory;
17-
% delete(h);
18-
% else
13+
if ispc() && ~stdlib.has_java()
14+
h = NET.addAssembly('Microsoft.VisualBasic');
15+
ci = Microsoft.VisualBasic.Devices.ComputerInfo();
16+
bytes = ci.TotalPhysicalMemory;
17+
delete(h);
18+
else
1919
b = javaOSBean();
2020

2121
if stdlib.java_api() < 14
@@ -24,7 +24,7 @@
2424
bytes = b.getTotalMemorySize();
2525
end
2626
bytes = uint64(bytes);
27-
% end
27+
end
2828

2929
% https://docs.oracle.com/en/java/javase/21/docs/api/jdk.management/com/sun/management/OperatingSystemMXBean.html#getTotalMemorySize()
3030

0 commit comments

Comments
 (0)