Issue
-
The memory utilization on the Jenkins® controller is close to the limit
-
Why is all the memory on my Jenkins server used?
-
free -m
shows all the memory on my Linux server as used
Resolution
# free -m total used free shared buffers cached Mem: 8178088 8041548 136540 0 0 3802444 -/+ buffers/cache: 4239104 3938984
In order to find the real memory consumption you should look in the -/+ buffers/cache:
used and free columns instead. In the above example the actual memory used is 4.23GB, while 3.93GB is free memory.
On Linux distribution versions that include /proc/meminfo: provide estimated available memory, the available
column can be checked instead (example here).
The Mem used column displays the sum of -/+ buffers/cache:
used + disk cache(cached
column at end). The disk cache is a method used in *nix operating systems to prevent disk I/O and stores it in memory. This is used to cache things like jars, log files, text files, etc.
If you would like to clean up the disk cache you can run the command: echo 3 | sudo tee /proc/sys/vm/drop_caches
to see the Mem used and free column change (but this is not required since the OS will do this over time for you).
Please check with your OS provider for other methods to more aggressively flush cache.