free / top difference. Does free show virtual memory?
The "Mem" line of free
doesn't show virtual memory usage, it shows physical memory usage.
The "RES" (for resident) and "%MEM" columns from top
shows you the same: the physical memory being used by each process.
free
does show you the available and used swap space, and top
has its "VIRT" column, both of which can be important. Roughly, swap space plus physical memory gives you your total possible virtual memory space. Get up to that limit and you'll start getting processes killed or unable to allocate memory and things will be bad.
Related videos on Youtube
Fabian Zeindl
Updated on September 18, 2022Comments
-
Fabian Zeindl almost 2 years
free -m
shows me the following in my system:total used free shared buffers cached Mem: 3954 3842 111 0 248 2585 -/+ buffers/cache: 1008 2945 Swap: 3811 4 3807
So memory looks pretty used up, but
top
sorted by memory shows the following top-processes:PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 8891 minecraf 20 0 2374m 277m 9.9m S 1 7.0 0:12.21 java 8704 root 39 19 2802m 272m 11m S 0 6.9 0:28.73 java
The virtual memory used by java seems to be huge, but i learned on the internet that that's not a problem. So i guess my question is: Why does
free
show the virtual memory, if it's not that meaningful?-
clerksx about 12 yearsJust because this particular information might not be useful for your particular scenario, it doesn't mean that it isn't useful in other situations.
-
-
Fabian Zeindl about 12 yearsThen i don't get why my memory is almost used up. Those two processes are at the top, beneath it all other processes use < 5MB res memory.
-
John Flatness about 12 yearsYes, the "Mem" and "+/- buffers/cache" lines can be a little confusing, but there's another question here that has some explanation. For what you're probably expecting for free memory, I'd look at the "free" column of the "+/-" row.
-
CMCDragonkai almost 9 yearsIs buffers/cache part counted as part of virtual memory or resident memory?