What is using all my RAM? Understanding the output of top

8,402

The short answer is that the rest of your memory is used to cache your applications.

The long answer can be found here.

Share:
8,402

Related videos on Youtube

TommesDee
Author by

TommesDee

I work at Crossref. Interested in Java, Clojure, Rust these days.

Updated on September 18, 2022

Comments

  • TommesDee
    TommesDee almost 2 years

    I've read a number of top memory use questions but I don't think they answer this.

    Here's the most significant part of a top run:

    top - 01:11:41 up 4 days,  1:06,  3 users,  load average: 0.00, 0.03, 0.26
    Tasks:  86 total,   1 running,  84 sleeping,   0 stopped,   1 zombie
    Cpu(s):  0.4%us,  0.4%sy,  0.0%ni, 99.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:   1022816k total,   986704k used,    36112k free,    11200k buffers
    Swap:  1048572k total,   419088k used,   629484k free,   408172k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                         
     2022 django    20   0  463m  87m  688 S  0.4  8.7   0:44.06 redis-server                                    
     6047 django    20   0  106m  25m 3900 S  0.4  2.6   0:16.57 python                                          
     6046 django    20   0 40892  13m 2852 S  0.0  1.4   0:00.14 python                                          
     6887 postgres  20   0 98752 5240 4100 S  0.0  0.5   0:00.60 postgres                                        
     6512 root      20   0 70820 2528 1776 S  0.0  0.2   0:00.03 sshd                                            
     3614 root      20   0 70820 2452 1696 S  0.0  0.2   0:00.03 sshd                                            
     6892 postgres  20   0 99028 2044  720 S  0.0  0.2   0:00.53 postgres                                        
    12983 django    20   0 18332 1968 1156 S  0.0  0.2   0:00.06 bash                                            
     3627 joe       20   0 71148 1660  632 S  0.0  0.2   0:00.84 sshd                                            
     6890 postgres  20   0 98752 1640  500 S  0.0  0.2   0:02.59 postgres                                        
     3628 joe       20   0 18056 1588 1056 S  0.0  0.2   0:00.10 bash                                            
     6537 postgres  20   0 18000 1580 1100 S  0.0  0.2   0:00.04 bash                                            
     6893 postgres  20   0 70296 1564  296 S  0.0  0.2   0:00.38 postgres                                        
      708 mysql     20   0  166m 1560  408 S  0.0  0.2   3:08.15 mysqld                                          
     9221 root      20   0 31724 1456 1148 S  0.0  0.1   0:00.01 sudo
    

    This states that 986704k out of 1022816k is used (I make that about 96%). However the top 3 processes' percentages add up to 12.7%. Something is using nearly all of my RAM and I can't tell what it is. free shows me similar numbers.

    Any suggestions about trying to find out what's using this all?

    (I notice there's 1 zombie process. Could it be that?)

  • TommesDee
    TommesDee over 12 years
    That could be it. I have written 200,000 files to disk recently.