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

首頁 > 系統 > Linux > 正文

實用技巧:Linux操作系統釋放cache內存

2024-06-28 13:04:10
字體:
來源:轉載
供稿:網友

/PRoc是個虛擬文檔系統,我們能夠通過對他的讀寫操作做為和kernel實體間進行通信的一種手段.也就是說能夠通過修改/proc中的文檔,來對當前kernel的行為做出調整.那么我們能夠通過調整/proc/sys/vm/drop_caches來釋放內存.操作如下:

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

0

首先,/proc/sys/vm/drop_caches的值,默認為0

[root@server test]# sync

手動執行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

[root@server test]# free -m

total used free shared buffers cached

Mem: 249 66 182 0 0 11

-/+ buffers/cache: 55 194

Swap: 511 0 511

再來運行free命令,發現現在的used為66MB,free為182MB,buffers為0MB,cached為11MB.那么有效的釋放了buffer和cache.

有關/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

are not freeable, the user should run sync(8) first.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 开封市| 五家渠市| 敦煌市| 大化| 冕宁县| 孟连| 安溪县| 伽师县| 德保县| 金华市| 东乌| 宜州市| 会宁县| 临夏县| 湘阴县| 杨浦区| 久治县| 思茅市| 象州县| 环江| 漯河市| 石嘴山市| 铅山县| 新郑市| 长顺县| 襄樊市| 乌什县| 玛多县| 布尔津县| 贵南县| 武鸣县| 康马县| 遂昌县| 都兰县| 宜阳县| 奈曼旗| 潍坊市| 丰县| 陆丰市| 南雄市| 施秉县|