On RedHat 5 servers, we see top reporting swap has 0k free. vmstat shows the same amount of swap used, but no paging. We kill our only app, and top still reports 100% of swap used. If we reboot, swap goes to 0k used. Any comments: am I interpreting top incorrectly? Is there really something in the swap partition? Can you point me to documentation that would address this? Can we correct it if incorrect?

Update: Swappiness is at default value of 60. To clarify the above, after killing our application, we (i.e., non-OS owned processes) have no processes running other than my shell and top itself, but continue to show 0k free swap. I believe that top is reporting incorrect information, not that we have no free swap space.


  • Top is sometimes not clear, what does vmstat show? – Tim Jan 6 '12 at 16:37
  • Many processes have memory that goes unused for long periods of time, or even the entire life of the process. If you swap is fully used and your swap activity is low, add more swap space -- you're freeing up some good memory cache. Otherwise, see the answers of others. – Jeff Ferland Jan 9 '12 at 17:15

Check your swappiness, too. Someone may have set it high.

cat /proc/sys/vm/swappiness


Just because you kill your largest memory-using process doesn't mean that the kernel is going to immediately start swapping pages in from disk. If those pages aren't actively being used, they're going to stay there until referenced again by the process that has those parts of memory swapped out. Swappiness will affect how aggressive the kernel is at moving things in and out of swap.

https://help.ubuntu.com/community/SwapFaq#What_is_swappiness_and_how_do_I_change_it.3F has a good discussion on what swappiness actually does and how changing it might affect your system.

Like charles said, you may have it set inappropriately high for some reason.

  • Thanks for you rcomments. When I kill my application process, I hqave nothing but OS-related processes (and my shell) running. If the paged memory related to my process which is now killed, the pages will never be referenced. Does the OS do some sort of garbage-collection-like activity to discard thos pages? BTW, swappiness is 60. – cvsdave Jan 9 '12 at 17:17
  • Yes, they're marked as dirty so they can be later re-used. linux-tutorial.info/modules.php?name=MContent&pageid=311 has a decent overview. – Travis Campbell Jan 12 '12 at 19:59

Top does not normally report any of the memory statistics in percentages, so I'm going to run with the assumption that you have calculated the percentage free yourself. While you are in top press "G3" to show a summary of the memory used by each process. Which process is taking up all the memory, is it your APP or something your APP is using? If you can try killing the app which is taking up the memory, you should see your free memory come back after a while. Once the system has started swapping it can take time to recover. In addition make sure you have actually allocated your system enough physical RAM. If your memory allocation is less than 512MB, consider using 512MB as your base minimum, though this only applies if your system is a virtualized guest.

  • 1
    You are entirely correct. I have changed "0% free" to "0k free", and "0% used " to "0k used". – cvsdave Jan 9 '12 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.