Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to determine the available physical memory in linux

Tags:

linux

memory

I'm trying to figure if my software running on linux suffers from memory leak. I've tried to measure the available physical memory as found in /proc/meminfo (see below) but could understand which field(s) represents the available memory and what is the relation between MemFree, Cached, Buffers, Active, Inactive.

cat /proc/meminfo
MemTotal:       124128 kB
MemFree:         62872 kB
Buffers:             0 kB
Cached:          15624 kB
SwapCached:          0 kB
Active:          38724 kB
Inactive:        11148 kB
SwapTotal:           0 kB
SwapFree:            0 kB
Dirty:               0 kB
Writeback:           0 kB
AnonPages:       34272 kB
Mapped:          14640 kB
Slab:             5564 kB
SReclaimable:      424 kB
SUnreclaim:       5140 kB
PageTables:        504 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
WritebackTmp:        0 kB
CommitLimit:     62064 kB
Committed_AS:    57936 kB
VmallocTotal:   655360 kB
VmallocUsed:      1016 kB
VmallocChunk:   654328 kB 
like image 733
eli Avatar asked Mar 12 '11 19:03

eli


People also ask

How do I check my total physical memory?

Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab to see current RAM usage displayed in the Memory box, and total RAM capacity listed under Physical Memory.

What is available memory Linux?

available memory in Linux is, that free memory is not in use and sits there doing nothing. While available memory is used memory that includes but is not limited to caches and buffers, that can be freed without the performance penalty of using swap space.

How do I check my server physical memory?

Right-click on Start menu button and then click on Task Manager . Click on Performance tab and then on Memory option. The Memory option shows details such as Total memory, used memory and available memory. This option also shows two graphs related to the Memory in the server.


2 Answers

This is simpler command to check memory usage:

free
like image 75
ngduc Avatar answered Oct 20 '22 05:10

ngduc


/proc/meminfo is for overall system memory information. /proc/[pid]/status has the memory usage info for an individual process. (it's also in /proc/[pid]/stat in a more machine parseable format).

In particular, VmData (size of data segment) and VmStk (size of stack segments) are most likely of use to you. Or just use ps or top instead of trying to read the data directly yourself.

The other numbers are likely to just be confusing, because the overall system memory usage is complicated by shared memory, various kinds of buffers, etc.

like image 38
freiheit Avatar answered Oct 20 '22 06:10

freiheit