当前位置:网站首页>Clean up system cache and free memory under Linux
Clean up system cache and free memory under Linux
2022-07-01 22:29:00 【Hua Weiyun】
When linux After reading files frequently , Physical memory will soon run out , When the program is finished , Memory will not be released normally , But all the time caching, Therefore, it is necessary to manually clean up the system cache to free memory .
sync
The operating system is running , The accessed files will be placed in buffer in . To avoid power failure , Data loss caused by faults such as , We need to take buffer Cache data in is written to disk
> sync;sync;sync
Do it manually sync command ( describe :sync The command runs sync Subroutines . If you have to stop the system , Then run sync Command to ensure file system integrity .sync Command to write all unwritten system buffers to disk , Include modified i-node、 Delayed block I/O And read-write mapping files
Manual memory release command
> echo 3>/proc/sys/vm/drop_caches
drop_caches The value of can be 0-3 Number between , It means different things :
- 0: Don't release ( System default )
- 1: Free page cache
- 2: Release dentries and inodes
Look at the memory
> free -h
total—— Total physical memory used—— Used memory , Generally, this value will be relatively large , Because this value includes cache+ Memory used by the application free—— Completely unused memory shared—— Application shared memory buffers—— cache , It's mainly used for catalogues ,inode It's worth waiting for (ls Large directories can see this value increase )cached—— cache , For open files
Restore default settings
Caching can improve the efficiency of the system , If you find that the system memory is often insufficient , You should consider adding memory , Instead of cleaning up often
> echo 0>/proc/sys/vm/drop_caches
Link to the original text :https://rumenz.com/rumenbiji/linux_drop_caches.html
WeChat official account : Entry station
- reply 【1001】 obtain linux Quick reference manual of common commands
- reply 【10010】 obtain Alibaba cloud ECS Operation and maintenance Linux System diagnosis
- reply 【10012】 obtain Linux Learning notes 【 The strong summary is worth seeing 】
- reply 【10013】 obtain shell A concise tutorial
边栏推荐
- [live broadcast review] the first 8 live broadcasts of battle code Pioneer have come to a perfect end. Please look forward to the next one!
- "The silk road is in its youth and looks at Fujian" is in the hot collection of works in the Fujian foreign youth short video competition
- plantuml介绍与使用
- Aidl basic use
- Burpsuite simple packet capturing tutorial [easy to understand]
- 灵动微 MM32 多路ADC-DMA配置
- 企业架构与项目管理的关联和区别
- 游览器打开摄像头案例
- Flume面试题
- Four methods of JS array splicing [easy to understand]
猜你喜欢
Is PMP certificate really useful?
【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程
pytest合集(2)— pytest运行方式
I received a letter from CTO inviting me to interview machine learning engineer
One of the basic learning of function
[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial
Copy ‘XXXX‘ to effectively final temp variable
多种智能指针
MySQL series transaction log redo log learning notes
二叉树的基本操作
随机推荐
【MySQL】数据库优化方法
Flume interview questions
MySQL清空表数据
MySQL learning notes - SQL optimization of optimization
信标委云原生专题组组长,任重道远!
打出三位数的所有水仙花数「建议收藏」
An operation tool used by we media professionals who earn 1w+ a month
Spark interview questions
AirServer2022最新版功能介绍及下载
Use of vscode
Matlab traverses images, string arrays and other basic operations
Smart micro mm32 multi-channel adc-dma configuration
物联网rfid等
MySQL系列之事务日志Redo log学习笔记
Tops, the unit of computing power of the processor, can be carried out 1 trillion times per second
首席信息官对高绩效IT团队定义的探讨和分析
LIS (longest ascending subsequence) problem that can be understood [easy to understand]
[noip2013] building block competition [noip2018] road laying greed / difference
Qtreeview+qabstractitemmodel custom model: the third of a series of tutorials [easy to understand]
灵动微 MM32 多路ADC-DMA配置