国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

linux 內存清理/釋放命令總結

2019-11-02 16:31:57
字體:
來源:轉載
供稿:網友

本文介紹了linux 內存清理/釋放命令,具體如下:

1.清理前內存使用情況

free -m

2.開始清理 

echo 1 > /proc/sys/vm/drop_caches

3.清理后內存使用情況

free -m

4.完成!

查看內存條數命令:

dmidecode | grep -A16 "Memory Device$"# sync# echo 1 > /proc/sys/vm/drop_caches echo 2 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches

cache釋放:

To free pagecache:

echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

說明,釋放前最好sync一下,防止丟數據。

因為LINUX的內核機制,一般情況下不需要特意去釋放已經使用的cache。這些cache起來的內容可以增加文件以及的讀寫速度。

先說下free命令怎么看內存

[root@yuyii proc]# freetotal  used  free   shared buffers cachedMem: 515588 295452 220136 0   2060  64040-/+ buffers/cache: 229352 286236Swap: 682720 112 682608

其中第一行用全局角度描述系統使用的內存狀況:

total――總物理內存

used――已使用內存,一般情況這個值會比較大,因為這個值包括了cache+應用程序使用的內存

free――完全未被使用的內存

shared――應用程序共享內存

buffers――緩存,主要用于目錄方面,inode值等(ls大目錄可看到這個值增加)

cached――緩存,用于已打開的文件

note:

 

  total=used+free  used=buffers+cached (maybe add shared also)

第二行描述應用程序的內存使用:

前個值表示-buffers/cache――應用程序使用的內存大小,used減去緩存值

后個值表示+buffers/cache――所有可供應用程序使用的內存大小,free加上緩存值

note:  

-buffers/cache=used-buffers-cached  +buffers/cache=free+buffers+cached第三行表示swap的使用:

used――已使用

free――未使用

手動執行sync命令(描述:sync 命令運行 sync 子例程。如果必須停止系統,則運行 sync 命令以確保文件系統的完整性。sync 命令將所有未寫的系統緩沖區寫到磁盤中,包含已修改的 i-node、已延遲的塊 I/O 和讀寫映射文件)

[root@server test]# echo 3 > /proc/sys/vm/drop_caches[root@server test]# cat /proc/sys/vm/drop_caches 3 

!將/proc/sys/vm/drop_caches值設為3

有關/proc/sys/vm/drop_caches的用法在下面進行了說明

/proc/sys/vm/drop_caches (since Linux 2.6.16)

Writing to this file causes the kernel to drop clean caches,

dentries and inodes from memory, causing that memory to become

free.

To free pagecache, use echo 1 > /proc/sys/vm/drop_caches; to

free dentries and inodes, use echo 2 > /proc/sys/vm/drop_caches;

to free pagecache, dentries and inodes, use echo 3 >

/proc/sys/vm/drop_caches.

Because this is a non-destructive operation and dirty objects

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 忻城县| 台东县| 顺平县| 崇阳县| 台前县| 萍乡市| 开鲁县| 积石山| 石狮市| 禄丰县| 微山县| 汶上县| 土默特左旗| 南安市| 宾阳县| 佛坪县| 夏津县| 色达县| 青河县| 雷山县| 金坛市| 泉州市| 隆林| 鹿泉市| 盐亭县| 福鼎市| 沐川县| 砚山县| 福清市| 吉隆县| 镇雄县| 长寿区| 田阳县| 萝北县| 教育| 京山县| 和林格尔县| 普兰县| 辉南县| 铜川市| 同心县|