Skip to content

Commit 8faa991

Browse files
committed
disable dotnet.device due to instability
1 parent 5b6f41e commit 8faa991

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

+stdlib/+dotnet/device.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
function i = device(path)
22

3+
% this has been not so stable, so we disabled it and leave it here for reference.
4+
35
i = [];
46

57
h = NET.addAssembly('System.Management');

+stdlib/+dotnet/ram_total.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function bytes = ram_total()
22
% .NET is 2-3x faster than Java for this
33
% https://learn.microsoft.com/en-us/dotnet/api/system.gcmemoryinfo.totalavailablememorybytes
4-
bytes = System.GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
4+
bytes = uint64(System.GC.GetGCMemoryInfo().TotalAvailableMemoryBytes);
55
end

+stdlib/+python/disk_capacity.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
% int64 first is for Matlab <= R2022a
77
catch e
88
warning(e.identifier, "disk_capacity(%s) failed: %s", d, e.message);
9-
f = [];
9+
f = 0;
1010
end
1111

12+
f = uint64(f);
13+
1214
end

+stdlib/+sys/disk_capacity.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
[s, t] = system(cmd);
1313
if s == 0
14-
t = strip(t);
14+
t = str2double(t);
1515
else
16-
t = "";
16+
t = 0;
1717
end
1818

19+
t = uint64(t);
20+
1921
end

+stdlib/device.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
if stdlib.has_python()
1111
i = stdlib.python.device(p);
12-
elseif ispc() && stdlib.has_dotnet()
13-
i = stdlib.dotnet.device(p);
1412
elseif isunix() && stdlib.java_api() >= 11
1513
% Java 1.8 is buggy in some corner cases, so we require at least 11.
1614
i = stdlib.java.device(p);

+stdlib/disk_capacity.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
end
99

1010
f = uint64(0);
11+
`
1112
if ~stdlib.exists(d), return, end
1213

1314
if stdlib.has_dotnet()
14-
f = System.IO.DriveInfo(stdlib.absolute(d)).TotalSize();
15-
% https://learn.microsoft.com/en-us/dotnet/api/system.io.driveinfo.totalsize
15+
f = stdlib.dotnet.disk_capacity(d);
1616
elseif stdlib.has_java()
17-
f = javaObject("java.io.File", d).getTotalSpace();
17+
f = stdlib.java.disk_capacity(d);
1818
elseif stdlib.has_python()
1919
f = stdlib.python.disk_capacity(d);
2020
end

0 commit comments

Comments
 (0)