4GB内存被闲置?

4GB内存被闲置?

我的系统中安装了 32GB 内存,但运行一两天后,内存开始不知何故增加。使用free,系统声称正在使用 27 个可用内存中的 8.9GB:

jeff@pop-os:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:            27Gi       8.9Gi        12Gi       540Mi       5.4Gi        15Gi
Swap:           23Gi       241Mi        23Gi

top证实了这一点,称正在使用 9GB。

jeff@pop-os:~$ top

top - 23:15:51 up 12:34,  1 user,  load average: 0.51, 0.91, 1.25
Tasks: 559 total,   2 running, 556 sleeping,   0 stopped,   1 zombie
top - 23:16:04 up 12:35,  1 user,  load average: 0.47, 0.88, 1.23
Tasks: 559 total,   1 running, 557 sleeping,   0 stopped,   1 zombie
%Cpu(s):  1.0 us,  1.7 sy,  0.9 ni, 96.1 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  27906.3 total,  13294.2 free,   9004.8 used,   5607.3 buff/cache
MiB Swap:  24131.5 total,  23890.5 free,    241.0 used.  16519.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                
   5003 jeff      17  -3 4360484 439680 137132 S  10.6   1.5  54:30.51 gnome-shell                                                                                                            
 242867 jeff      17  -3 1368008 180628  31488 S  10.0   0.6  10:36.26 python3                                                                                                                
   5826 jeff      26   6   32.4g 266512 113564 S   7.3   0.9  88:07.44 code-insiders                                                                                                          
   4841 jeff      17  -3   25.0g 222276 115132 S   6.6   0.8  22:56.82 Xorg                                                                                                                   
 282966 jeff      26   6   33.1g 719120 457248 S   4.3   2.5   1:16.06 chrome                                                                                                                 
   5960 jeff      26   6 1130.0g 265240 104044 S   3.7   0.9  48:17.31 code-insiders                                                                                                          
 282086 jeff      20   0  571220  62248  40924 S   3.7   0.2   0:04.14 gnome-terminal-                                                                                                        
  22297 jeff      26   6 1129.9g 481488 106444 S   3.0   1.7  52:37.24 code-insiders                                                                                                          
   5952 jeff      26   6 1129.9g 212484  96116 S   2.3   0.7  18:23.47 code-insiders                                                                                                          
  11636 jeff      26   6 1137.3g 423932 150340 S   2.0   1.5  17:19.96 Discord                                                                                                                
 267139 jeff      20   0 3138796 314556 111700 S   1.7   1.1   4:45.19 Isolated Web Co                                                                                                        
 283220 jeff      26   6 1131.0g 157136 117536 S   1.3   0.5   0:02.01 chrome                                                                                                                 
    842 root     -51   0       0      0      0 S   1.0   0.0   8:51.13 irq/94-nvidia                                                                                                          
 283014 jeff      26   6   32.7g 290320 165980 S   1.0   1.0   0:20.84 chrome                                                                                                                 
    879 root      32  12    2812   2144   1924 S   0.7   0.0   1:02.21 acpid                                                                                                                  
 281955 root      20   0       0      0      0 D   0.7   0.0   0:00.31 kworker/u32:0+events_unbound                                                                                           
 283015 jeff      20   0   32.4g 125364  96720 S   0.7   0.4   0:05.89 chrome                                                                                                                 
     14 root      20   0       0      0      0 S   0.3   0.0   0:05.73 ksoftirqd/0                                                                                                            
    710 root     -51   0       0      0      0 S   0.3   0.0   5:22.12 irq/93-rtw89_pci                                                                                                       
    886 root      32  12  153956   6336   5616 S   0.3   0.0   0:12.25 system76-power                                                                                                         
   1168 root      32  12 2319660  52584  33364 S   0.3   0.2   0:38.67 containerd                                 

然而,将所有%MEM使用量加起来总共为 14.5%,总计不到 4GB(假设总计 27GB 的低端)。这使得 4GB 下落不明——它去哪儿了?

帮助调试的代码输出:

jeff@pop-os:~$ cat /proc/meminfo
MemTotal:       28576036 kB
MemFree:        14337988 kB
MemAvailable:   17364024 kB
Buffers:          111756 kB
Cached:          4890460 kB
SwapCached:          120 kB
Active:          7282988 kB
Inactive:        5117764 kB
Active(anon):    5806232 kB
Inactive(anon):  1964132 kB
Active(file):    1476756 kB
Inactive(file):  3153632 kB
Unevictable:         320 kB
Mlocked:             320 kB
SwapTotal:      24710644 kB
SwapFree:       24433396 kB
Zswap:                 0 kB
Zswapped:              0 kB
Dirty:              9512 kB
Writeback:             0 kB
AnonPages:       7398644 kB
Mapped:          1884072 kB
Shmem:            371896 kB
KReclaimable:     305196 kB
Slab:             628552 kB
SReclaimable:     305196 kB
SUnreclaim:       323356 kB
KernelStack:       34732 kB
PageTables:        98480 kB
SecPageTables:         0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    38998660 kB
Committed_AS:   22911908 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      292844 kB
VmallocChunk:          0 kB
Percpu:            21568 kB
HardwareCorrupted:     0 kB
AnonHugePages:      2048 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:     1423812 kB
DirectMap2M:    25688064 kB
DirectMap1G:     2097152 kB
jeff@pop-os:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           2.8G  3.6M  2.8G   1% /run
/dev/nvme1n1p7  316G  271G   30G  91% /
tmpfs            14G  421M   14G   4% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1    916G  627G  243G  73% /home/jeff/SSD_2
/dev/nvme1n1p5  5.3G  267M  5.0G   5% /boot/efi
tmpfs           2.8G  284K  2.8G   1% /run/user/1000
jeff@pop-os:~$ mount | grep tmpfs
udev on /dev type devtmpfs (rw,nosuid,relatime,size=14222632k,nr_inodes=3555658,mode=755,inode64)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=2857604k,mode=755,inode64)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=2857600k,nr_inodes=714400,mode=700,uid=1000,gid=1000,inode64)
jeff@pop-os:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           2.8G  3.6M  2.8G   1% /run
/dev/nvme1n1p7  316G  271G   30G  91% /
tmpfs            14G  421M   14G   4% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1    916G  627G  243G  73% /home/jeff/SSD_2
/dev/nvme1n1p5  5.3G  267M  5.0G   5% /boot/efi
tmpfs           2.8G  284K  2.8G   1% /run/user/1000
jeff@pop-os:~$ neofetch
             /////////////                jeff@pop-os 
         /////////////////////            ----------- 
      ///////*767////////////////         OS: Pop!_OS 22.04 LTS x86_64 
    //////7676767676*//////////////       Host: 82JY Legion 5 17ACH6H 
   /////76767//7676767//////////////      Kernel: 6.2.6-76060206-generic 
  /////767676///*76767///////////////     Uptime: 12 hours, 45 mins 
 ///////767676///76767.///7676*///////    Packages: 3116 (dpkg), 14 (flatpak), 9 (snap) 
/////////767676//76767///767676////////   Shell: bash 5.1.16 
//////////76767676767////76767/////////   Resolution: 1600x900, 1920x1080 
///////////76767676//////7676//////////   DE: GNOME 42.5 
////////////,7676,///////767///////////   WM: Mutter 
/////////////*7676///////76////////////   WM Theme: Pop 
///////////////7676////////////////////   Theme: Gruvbox-Dark-BL [GTK2/3] 
 ///////////////7676///767////////////    Icons: Uniform+ [GTK2/3] 
  //////////////////////'////////////     Terminal: gnome-terminal 
   //////.7676767676767676767,//////      CPU: AMD Ryzen 7 5800H with Radeon Graphics (16) @ 3.200GHz 
    /////767676767676767676767/////       GPU: AMD ATI 06:00.0 Cezanne 
      ///////////////////////////         GPU: NVIDIA GeForce RTX 3060 Mobile / Max-Q 
         /////////////////////            Memory: 9847MiB / 27906MiB 
             /////////////
                                                                  
                                                                  

相关内容