Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Why do ‘free’ and/or ‘top’ show different memory usage than the New Relic UI?



Both the free and top commands are often misinterpreted by users. This happens because neither is very clear about what it is actually measuring.


In the Mem row:

Total: The total amount of memory
Used: Total that has been used, at any point by the operating system.

In the -/+ buffers/cache row:

Used: Total amount actively in use by the system
Free: The total amount of free memory

Generally, most people mistake the amount on the first row under the free column as the amount of free memory on their system. This is incorrect; what this number means, is the amount of memory that hasn’t been used by the system – at all. In this example above, it’s 137 megabytes. The actual amount of free memory is listed underneath the free column on the second row (buffers/cache), in this case 828 megabytes. Memory listed in this column was at one point used by an application or the system but has since been “freed” up for use again (the kernel knows it can use this memory for whatever it’d like).

Finally, the amount of memory currently in use is listed underneath the used column of the second row (buffers/cache) and is roughly 712megabytes.

The problem with top again is how to interpret the output.

VIRT: Virtual size of process; sum all the of memory a process is actually using (including things like RAM from video cards), files in use (libraries), and shared memory.
RES: Resident size; the physical amount of memory a process is consuming (almost always less than VIRT because a process is generally dependent on a C-library).
SHR: How much of the VIRT is actually shareable (memory or libs); in the case of libraries it doesn’t mean the entire library (example: the VIRT will show the size of the entire library being loaded, while SHR only shows the functions actually loaded).

Confusing information used memory between server monitoring ui and "top"
archived #2