2

I have this situation with RAM and SWAP at the moment:

$ free -h
             total       used       free     shared    buffers     cached
Mem:          7,7G       7,5G       159M       100M        75M       5,9G
-/+ buffers/cache:       1,5G       6,1G
Swap:         7,9G       408M       7,5G

And I was wondering...

Is there a way to know what programs/data are RAM-cached and/or from which process do they come from?

Thank you very much in advance.

EDIT: to know the programs/data in SWAP follow the link provided by @xubu-tur .

dadexix86
  • 6,776

1 Answers1

5

The same question was asked at LinuxQuestions.org: http://www.linuxquestions.org/questions/linux-general-1/command-to-check-process-taking-high-cached-memory-927756/

The important part of the answer is:

Cache isn't associated with a process per se, it is related to I/O on your system.

Linux tries to cache as much I/O data as it can. If that data needs to be read in the future, it is already in storage. Cache is a mechanism to avoid doing real I/O operations as real I/O to a disk is very slow compared to just retrieving it from memory. So a high cache number is generally good and nothing to be concerned with.

So, no you can't know which programs or processes are in cache, becasue there are no such items there.

What you can find there is cached I/O, and as @bseiblod mentioned in his comment, you can find a solution to that here: How can you tell whether a file is being cached in memory in linux?

adosaiguas
  • 399
  • 3
  • 14