How to free up release unused cached memory in linux? Is it even possible, and if so, how do you do it? Read on to find out three ways to free up unused cached memory in Linux. Note that this doesn’t refer to physical RAM, but rather the virtual memory swap files used by your Linux system to store rarely-used pages of virtual memory. This can be particularly helpful when you have limited amounts of physical RAM installed on your system.
The first step is to look at your memory statistics, specifically information about how much RAM you are using. To get a detailed breakdown of everything running on your system, type pmap at a terminal prompt. The output will look something like The last column indicates how much physical RAM each process is using. Processes that have high numbers here could be eating up your available memory and causing an out-of-memory (OOM) error.
2) ps (top command)
The top command displays real-time information about your Linux system, including a list of active processes, CPU and memory statistics, and running tasks. It’s a quick way to identify any rogue or hung processes that may be hogging available memory. The top command also comes with some helpful flags that provide detailed information. Remember, when you kill an application with the kill command, it doesn’t necessarily release all of its cached memory this is where ps (top) can help.
The vmstat utility is available from your server’s operating system’s package manager and reports information about memory, swap space, block IO, and CPU activity. If you know how to interpret vmstat output, you can use it as a tool for freeing up unused cached memory. In some cases, Vmstat provides a snapshot of your system’s activity and can help you identify processes that are keeping cached memory or swap space occupied. You can then use that information to investigate further, kill off any unneeded processes or take additional actions like tuning how your server allocates memory.
memory fragmentation occurs when part of a file is deleted, but a small part of it remains on your computer. This means that when you try to save new files or modify existing ones, you may have limited space because some of it has been taken up by fragments from old files. Commonly used for system maintenance and optimization, the ps command will show all the processes running on your system. You can use this command to find out how much RAM each process is using and terminate them accordingly . Processes with lower RAM usage will generally take less time than higher-RAM-consuming processes.