free tells you what’s used. When I want to know what is actually installed and online, as the kernel sees it, I reach for a different tool that ships with util-linux.
lsmem --summary
The summary shows the total online and offline memory and the size of a single memory block. Without --summary you get the ranges of physical addresses, each with its size, state and whether it is removable.
lsmem -a
lsmem -o +NODE
lsmem -J
-a lists every memory block on its own instead of merging similar ones. -o +NODE adds a column to the default set, and -J gives JSON for scripts. --summary=only is the same as plain --summary.
The caveat: lsmem describes address ranges and blocks, not the sticks in your slots. If you want the modules, their size and speed, use dmidecode -t memory instead. The two answers also won’t match exactly, because the kernel only counts what it manages.
I’d run it next to free -h after adding RAM or changing a VM’s memory. If the total here is lower than you expect, the problem is below the operating system, in the BIOS or the hypervisor settings, and not in your processes.
Further reading: lsmem man page