1. 用命令 free -m 查看一下内存的使用情况:
然后清除缓存后再来查看一下内存的使用情况:
前后对比可发现,缓存由之前的110M缩小到了25M,效果比较明显。
2. 下面说一下 drop_caches:
清空 pagecache:
sync
echo 1 > /proc/sys/vm/drop_caches
或者:
sync
sysctl -w vm.drop_caches=1
清空 dentries 和 inodes:
sync
echo 2 > /proc/sys/vm/drop_caches
或者:
sync
sysctl -w vm.drop_caches=2
清空所有缓存(pagecache、dentries 和 inodes):
sync
echo 3 > /proc/sys/vm/drop_caches
或者:
sync
sysctl -w vm.drop_caches=3
3. 如果尝试向 drop_caches 中写入 0,会报下面错误:
-bash: echo: write error: Invalid argument
我的内核是3.4.39,64 位。至于什么原因,我没找到。但是从下面关于 drop_caches 的说明来看,drop_caches 的值并没有说可以设置成 0 的,但是 drop_caches 的默认值是 0。但是 2.6.x 的内核将 drop_caches 的值设置为 0 是没有问题的。
关于 drop_caches:
Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache...
To use /proc/sys/vm/drop_caches, just echo a number to it.
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
This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run "sync" first to flush them out to disk, these drop operations will
tend to free more memory.
转自:http://blog.csdn.net/sky_qing/article/details/8988461
分享到:
相关推荐
Linux的caches的分析,如何手工释放caches。
本文介绍了linux 内存清理/释放命令,具体如下: 1.清理前内存使用情况 free -m 2.开始清理 echo 1 > /proc/sys/vm/drop_caches 3.清理后内存使用情况 free -m 4.完成! 查看内存条数命令: dmidecode |...
通过实验获得的真实数据记录与分析,Cache的大小对系统性能的影响。
手工释放linux内存_procsysvmdrop_caches.pdf
清理Ubuntu的页面缓存, drop vm cache。一般大家在做大型工程的编译时,比如linux kernel,Android等总会遇到内存爆满,系统一旦开始刷新swap就奇慢无比,实际上是因为系统硬件内存部分被占满(其中大部分被载入内存...
ecshop page caches 提高浏览速度
echo 1 > /proc/sys/vm/drop_caches drop_caches的值可以是0-3之间的数字,代表不同的含义: 0:不释放(系统默认值) 1:释放页缓存 2:释放dentries和inodes 3:释放所有缓存 释放完内存后改回去让系统重新自动...
这几天发现CentOS系统内存一直涨,即使把apache和mysql关闭了,内存也不释放,可以... #echo 1 > /proc/sys/vm/drop_caches # To free dentries and inodes: #echo 2 > /proc/sys/vm/drop_caches # To fre
linux 清理内存命令 1.清理前内存使用情况 free -m 2.开始清理 echo 1 > /proc/sys/vm/drop_caches 3.清理后内存使用情况 free -m 4.完成! 查看内存条数命令: # sync # echo 1 > /proc/sys/vm/drop_caches ...
esri的server中的Caches介绍
关于s3c2410 如何操作cache的文档,有助于了解三星的ARM原理
Linux 系统内存性能测试shell脚本 脚本使用了 dd 命令和 /proc/sys/vm/drop_caches 文件来测试内存的读写速度和带宽
在托管大数据分析中从序列化和垃圾收集中释放计算缓存_Freeing Compute Caches from Serialization and Garbage Collection in Managed Big Data Analytics.pdf
2.echo 1 > /proc/sys/vm/drop_caches 以上内容比较简单,成功的给大家介绍了Linux 内存释放命令的知识,希望能够帮助到大家! 您可能感兴趣的文章:php查找指定目录下指定大小文件的方法linux下查看内存条数及每根...
CPU缓存以及您为什么要关心在我的macOS笔记本电脑上,我得到以下结果: [count_odds_row_major_traversal]avg = 52.22233msmid = 52.595066msmin = 50.999287msmax = 53.521421ms[count_odds_col_major_traversal]...
mybatis-memcached-1.0.0
缓存依赖于设置环境变量CACHES_DSN : caches.interface.Redis://localhost/0 如果要使用多个Redis服务器缓存内容,则实际上可以设置多个环境变量: export CACHES_DSN_1=caches.interface.Redis://somedomain....
HDFS 基准 编译 为了能够运行 libhdfs 基准测试,请在编译时指定包含目录和库路径: ... $ sudo sync $ sudo echo 3 | sudo tee /proc/sys/vm/drop_caches 用dd测量磁盘读写速度 $ dd if=/dev/zero of
FastAPI缓存 将简单的轻量级缓存系统实现为FastAPI中的依赖项。 安装 pip install fastapi-cache 用法示例 from fastapi import Depends , FastAPI from fastapi_cache import caches , close_caches from fastapi_...
出于配置目的,下表将“Shelf”环境变量映射到它们的 Django 设置: 环境变量 Django 设置 开发默认 生产默认 DJANGO_AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID 不适用 引发错误 DJANGO_AWS_SECRET_ACCESS_KEY AWS_...