---
title: "Linux 释放内存方法"
author: "swvip"
date: "2011-02-18T11:12:59Z"
tags: ["Cache", "Linux"]
categories: ["操作系统"]
slug: "linux"
draft: false
lastmod: "2011-02-18T11:12:59Z"
id: 909749
url: "https://swvip.iteye.com/blog/909749"
---

先看看内存使用状况  
\[root@node1 ~]# free -m  
total used free shared buffers cached  
Mem: 8004 6557 1446 0 163 5630  
\-/+ buffers/cache: 763 7240  
Swap: 1983 0 1983  
把内存里的数据暂时写到硬盘里  
\[root@node1 ~]# sync  
修改 /proc/sys/vm/drop\_caches文件  
\[root@node1 ~]# echo 3 &gt; /proc/sys/vm/drop\_caches  
\[root@node1 ~]# cat /proc/sys/vm/drop\_caches  
再看内存   
\[root@node1 ~]# free -m  
total used free shared buffers cached  
Mem: 8004 631 7372 0 0 60  
\-/+ buffers/cache: 570 7433  
Swap: 1983 0 1983