[Lazarus] GlobalMemoryStatus is Windows only, how to get installed RAM on Linux ?
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Wed Aug 16 15:38:25 CEST 2017
On 2017-08-16 14:09, Michael Van Canneyt via Lazarus wrote:
> Your best options is most likely to read /proc/meminfo and parse the result.
> It contains a wealth of information.
Just a side note:
/proc/meminfo is specific to Linux, and doesn't apply to other
Unix-like operating systems like Solaris, FreeBSD etc.
For example, under FreeBSD you can execute the following command and
read the results back.
$ /sbin/sysctl hw.physmem
hw.physmem: 34,272,751,616
..and similar for other hardware under FreeBSD:
$ /sbin/sysctl hw.model
hw.model: Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz
Also worthy noting that the sysctl command can be executed without root
access, even though it lives in the 'sbin' directory. This is super handy.
Landmesser John, if you look in the OnGuard project in the
source/onguard.pas unit, there is code for Windows, Linux and FreeBSD
(latter is still limited info) that extracts such information. You are
welcome to copy some of that code as you need it.
The OnGuard Git repository can be found in the link below, and the web
interface also has a "download zip" option.
https://github.com/graemeg/onguard
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the Lazarus
mailing list