zcalusic / sysinfo

Sysinfo is a Go library providing Linux OS / kernel / hardware system information.
MIT License
527 stars 93 forks source link

Workaround for memory size as non-root user #16

Open Lauri-Nomme opened 5 years ago

zcalusic commented 5 years ago

Hello @Lauri-Nomme and thanks for your contribution!

While I understand that some people would prefer to run sysinfo utility without superuser privileges, unfortunately I have not found the way to extract the exact amount of RAM installed in that case. /proc/meminfo was the first thing I consulted, only to find out that it doesn't really show the total RAM installed, but some smaller number (yes, even in MemTotal row).

Using workaround like this would mean that you get completely different values, depending on which user ran the utility, and such kind of indeterminism is not welcome in utility like this, IMHO.

For example, on my desktop I would get size: 15908, instead of the correct size: 16384.