zoukankan      html  css  js  c++  java
  • linux中清除cache的方法

    在进行测试文件导入的时候,发现内存占用很大,如下所示:

    [root@python ~]# vmstat 1 -S M  3
    procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
     0  0      0    196      0    730    0    0    50     6   13    8  0  0 100  0  0	
     0  0      0    196      0    730    0    0     0     0   18    7  0  0 100  0  0	
     0  0      0    196      0    730    0    0     8     0   26   28  0  0 97  3  0	

    其中的cache占用很多,free的内存也很少,从而在进行继续测试的时候,需要清除缓存,那么执行以下的命令即可:

    [root@python ~]# echo 1 > /proc/sys/vm/drop_caches  #仅仅清除页面缓存,也就是pagecache


    清除之后结果如下所示:


    [root@python ~]# vmstat 1 -S M  3
    procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
     0  0      0    916      0     10    0    0    50     6   13    8  0  0 100  0  0	
     0  0      0    916      0     10    0    0     0     0   16   11  0  0 100  0  0	
     0  0      0    916      0     10    0    0     0     0   16   11  0  0 100  0  0	


    for linux and python
  • 相关阅读:
    Android
    Android
    Android
    Android
    Android
    Android
    Android
    Android
    Android
    Android
  • 原文地址:https://www.cnblogs.com/kellyseeme/p/5525047.html
Copyright © 2011-2022 走看看