当前位置:网站首页>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
边栏推荐
- idea中类中显示成员变量和方法
- Which securities company should we choose to open an account for flush stock? Is it safe to open an account with a mobile phone?
- 测试撤销1
- require与import的区别和使用
- Basic operation of binary tree
- 一次调试去了解redis集群的slot机制
- Chapter 9 Yunji datacanvas company has been ranked top 3 in China's machine learning platform market
- Fundamentals - IO intensive computing and CPU intensive computing
- Tops, the unit of computing power of the processor, can be carried out 1 trillion times per second
- js如何获取集合对象中某元素列表
猜你喜欢
随机推荐
灵动微 MM32 多路ADC-DMA配置
Matlab traverses images, string arrays and other basic operations
AirServer2022最新版功能介绍及下载
详解ThreadLocal
Which securities company should we choose to open an account for flush stock? Is it safe to open an account with a mobile phone?
Spark面试题
Internet of things RFID, etc
vscode的使用
PMP与NPDP之间的区别是什么?
Is PMP certificate really useful?
Application of real estate management based on 3D GIS
C中main函数的几种写法
Do you want to make up for the suspended examination in the first half of the year? Including ten examinations for supervision engineers, architects, etc
【MySQL】数据库优化方法
Why does blocprovider feel similar to provider?
Count the number of each character in the character
TOPS,处理器运算能力单位、每秒钟可进行一万亿次
Separate the letters and numbers in the string so that the letters come first and the array comes last
基于LSTM模型实现新闻分类
【MySQL】索引的创建、查看和删除