

This is just a brief introduction about memory utilization in Linux. but keep in mind that includes the SHR (shared physical memory) which mean it could have been used by some other process as well. So, to sum up, RES is most close to the memory used by the process in memory, excluding what’s swapped out.

SHR is the total physical shared memory that the process has access to.ĭATA is the total private memory mapped to process physical or not.ĬODE also known as “text resident set” is total physical memory used to load application code. RES is the total physical memory used shared or private that the process has access to. VIRT is the total memory that this process has access to shared memory, mapped pages, swapped out pages, etc. %MEM is directly related to RES, it’s the percentage use of total physical memory by the process. The important tables for memory to look are %MEM, VIRT, RES, SHR, CODE, DATA. In the above example let’s discuss first process “Xorg”. please read more about modifying default behavior of top command on the manpage.
See free memory linux code#
“ top” comes with a lot of information by default, but to get all the information we needed we will add two more columns CODE and DATA. Now, let us understand the memory utilization by processes, we will use “ top” command to get the required information. Linux by default tries to use RAM in order to speed up disk operations by making use of available memory for creating buffers (file system metadata) and cache (pages with actual contents of files or block devices), helping the system to run faster because disk information is already in memory which saves I/O operations. So, a question arises, why to cache and buffer at the first place? So, if applications request memory, then Linux OS will free up the buffers and cache to yield memory for the new application requests. The free column beside -/+ buffers/cache with 823 MB is the actual free memory available to Linux.

Using the free -m command to check your Linux memory usage, displays the values as MB instead of KB.
See free memory linux for free#
But that does not just mean that application now can only request for 2943 MB free memory, If you look at the usage figures you can see that 5941 MB memory use is for buffers and cache. How do I free up memory on Linux The most common way you’ll see on the web to check for free memory in Linux is by using the free command. In this example, total memory is 11901 MB, 8957 MB is used and 2943 MB free. Let’s see the below example and understand: you can read more about options on the manpage. The free command comes with the set of options you can choose to modify the results, like with option “-m” result will display memory in MegaByte. We will use free and top to understand the memory utilization of our operating system. The top command can display system summary information as well as a list of the process currently being managed by the Linux kernel. The “ top” command provides a dynamic real-time view of a running system. The “ free” command usually displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. Linux comes with many commands to check memory usage. It performs good with fewer resources and tries to maximize utilization of available resources automatically and because of this, it’s slightly difficult to understand resource utilization.
