磁盘缓存增大, 占据内存清除的方法
来源:互联网 发布:电子商务数据分析师 编辑:程序博客网 时间:2024/06/08 07:06
大家有没有遇到这种情况:在给tf卡或者usb存储设备持续写入文件的时候,内存占用会不断增加,一直到剩余很少内存的时候才停止占用更多内存。而这时候 如果其他模块急需更多内存,系统运行效率就会大大降低。最近google+baidu 翻阅了一些资料做如下总结:
频繁的文件访问会导致系统的Cache使用量大增,占用内存。
运行sync命令将dirty的内容写回硬盘
$sync
通过修改proc系统的drop_caches清理free的cache
$echo 3 > /proc/sys/vm/drop_caches
drop_caches的详细文档如下:
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
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
As this is a non-destructive operation, and dirty objects are notfreeable, the user should run "sync" first in order to make sure allcached objects are freed.
This tunable was added in 2.6.16
linux C 编程序可以用sync()函数替代命令。
- 磁盘缓存增大, 占据内存清除的方法
- Glide 缓存工具例子,缓存大小获取,磁盘缓存清除(2 种方法),内存缓存清除
- 增大tomcat内存的方法
- Android Volley的请求封装,实现图片内存缓存(防止OOM),数据磁盘缓存,及清除磁盘缓存
- linux清除内存缓存方法
- openmeeting中增大内存的方法
- Android模拟器增大内存的方法
- 清除缓存的方法
- 磁盘缓存和内存缓存的区别
- 磁盘缓存和内存缓存的区别
- 在linux下增大tomcat缓存的方法
- 增大JVM的内存
- 内存缓存+磁盘缓存
- php 清除缓存的方法
- response方法清除缓存的
- 清除ajax缓存的方法
- varnish清除缓存的方法
- 清除ARP缓存的方法
- linux网络数据统计
- metadata lock 对mysql的影响(1)
- Activity之间传递类对象
- 稀疏矩阵
- 冀中星被打后女友守候7晚上 得知其瘫痪后离开
- 磁盘缓存增大, 占据内存清除的方法
- linux调试工具总结
- SDWebimage
- GDB教程
- 运算符重载学习小记
- 一种计算两个不同样本集相似度的方法:Mahalanobis距离
- 数据库关键字
- POJ 3650
- CSS、JS中的相对路径引用