Memory size

This is like a newbie question.
The size of the memory that vmstat returns and the physical memory do not match.

Code:
$ dmesg  | grep memo
real memory  = 2147418112 (2047 MB)
avail memory = 2044317696 (1949 MB)
$
$ vmstat
procs  memory       page                    disks     faults         cpu
r b w  avm   fre   flt  re  pi  po    fr   sr ad0 pa0   in    sy    cs us sy id
1 0 0 271M  150M    11   0   0   0    19   14   0   0    2    36    91  0  1 99

The system runs in Virtualbox and is given 2GB memory, which matches the dmesg result, while vmstat says it has only 271+150=421MB.

I wonder why this happens.

The system is FreeBSD12.2 :
Code:
$ uname -a
FreeBSD fbsd12 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC  amd64

Thank you!
 
It's complicated. REALLY complicated. Do a search of this forum for "vmstat avm", and it will give you an idea of the complexity.

"avm" does not mean "available", and "fre" does not mean free. Just from reading the man page, it is clear that "avm" means active virtual memory, while "fre" means the size of the free list. There is double counting (the same phyical page can be mapped in several places), and there is undercounting (IO bounce buffers, video frame buffers, boot ROM).
 
Thank you, ralphbsz.

I noticed top shows something different from vmstat and, I took a look at user.bin/top and user.bin/vmstat and learned they look at different values.

vmstat uses vmtotal sysctl and top uses vm_pagequeue_count, both in vm/vm_meter.c of the kernel. I still do not know how different they are, but I understood they are different.

Anyway, I am relieved to know that my instance of FreeBSD has its memory that I set up.

Thank you.
 
Back
Top