Skip to content

Commit ed8fd1e

Browse files
committed
ram_{free,total}: system fallback if other fails
1 parent b378344 commit ed8fd1e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

+stdlib/ram_free.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
bytes = ram_free_java();
2525
elseif stdlib.has_python()
2626
bytes = py_ram_free();
27-
else
27+
end
28+
29+
if bytes <= 0
2830
bytes = ram_free_system();
2931
end
3032

+stdlib/ram_total.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
bytes = System.GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
1616
elseif stdlib.has_java()
1717
bytes = ram_total_java();
18-
else
18+
end
19+
20+
if bytes <= 0
1921
bytes = ram_total_system();
2022
end
2123

0 commit comments

Comments
 (0)