csgillespie / benchmarkme

Crowd sourced benchmarking
https://csgillespie.github.io/benchmarkme/
41 stars 13 forks source link

get_ram() cannot retrieve RAM #49

Open alemobile opened 1 year ago

alemobile commented 1 year ago

OS and Hardware:

OS: Windows 10, 09-2023 cumulative update (KB5030211) Laptop Model: HP ENVY Notebook - 15-ae112nl Processor: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz RAM: 16 GB R version: 4.3.1 "Beagle Scouts" benchmarkme package version: 1.0.8

Summary

get_ram() can't retrieve RAM and reports an Error that I don't recognize.

Steps to Reproduce

  1. Run get_ram() in R Console.

Actual Result

The following Error is printed:

Error in inherits(ram, "try-error") || length(ram) == 0L || is.na(ram) : 'length = 3' in coercion to 'logical(1)'

Expected Result

The amount of RAM installed on my laptop (16 GB).

Reported by

Alessandro Mazza.

ptompalski commented 5 months ago

Experienced similar issue:

get_ram()
Error in inherits(ram, "try-error") || length(ram) == 0L || is.na(ram) : 
  'length = 9' in coercion to 'logical(1)'

It seems that the cause of this error is in is.na(ram) - in my case the return values with benchmarkme:::system_ram(os) is a vector, not a single value:

[1] "68719476736  \r" "68719476736  \r" "68719476736  \r" "68719476736  \r"
[5] "68719476736  \r" "68719476736  \r" "68719476736  \r" "68719476736  \r"
[9] "\r"    

I think is.na(ram) should be changed to any(is.na(ram)). After that change get_ram() works fine on my PC. I will submit a PR shortly.