Programmatically, Linux will not tell you the actual physical size. Instead, you should read this information with SMBIOS using, for example,
sudo dmidecode -t memory | fgrep -ie 'size:'
( 4 RAM, 2 ):
Maximum Memory Module Size: 16384 MB
Maximum Total Memory Size: 65536 MB
Installed Size: 2048 MB (Single-bank Connection)
Enabled Size: 2048 MB (Single-bank Connection)
Installed Size: Not Installed
Enabled Size: Not Installed
Installed Size: 2048 MB (Single-bank Connection)
Enabled Size: 2048 MB (Single-bank Connection)
Installed Size: Not Installed
Enabled Size: Not Installed
Size: 2048 MB
Size: No Module Installed
Size: 2048 MB
Size: No Module Installed
( Enabled Size s, BIOS, ), ( ) 4096 . ( , , , , .)
,
fgrep -e 'MemTotal:' /proc/meminfo
, /proc/meminfo, , dmidecode.
MemTotal: 3988616 kB