当前位置:网站首页>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;syncDo 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_cachesdrop_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 -htotal—— 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

边栏推荐
猜你喜欢
![[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial](/img/b0/029cdea72483ed9bc8a0d66908983a.png)
[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial

Significance and measures of security encryption of industrial control equipment

I received a letter from CTO inviting me to interview machine learning engineer

Flume面试题

AirServer2022最新版功能介绍及下载
![[noip2013] building block competition [noip2018] road laying greed / difference](/img/d1/a56231cd4eb3cc1d91d8a55048ccfe.png)
[noip2013] building block competition [noip2018] road laying greed / difference

焱融看 | 混合云时代下,如何制定多云策略
![[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!](/img/27/4bd0de716f5cb360d54f140dc8e9c1.png)
[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!

91.(cesium篇)cesium火箭发射模拟

企业架构与项目管理的关联和区别
随机推荐
[deep learning] use deep learning to monitor your girlfriend's wechat chat?
[STM32] stm32cubemx tutorial II - basic use (new projects light up LED lights)
PHP reflective XSS, reflective XSS test and repair
Spark interview questions
Aidl basic use
【juc学习之路第8天】Condition
[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial
Airserver mobile phone third-party screen projection computer software
GaussDB(DWS)主动预防排查
Getting started with the lockust series
Unity 使用Sqlite
locust 系列入门
地图其他篇总目录
List announced | outstanding intellectual property service team in China in 2021
Design and practice of new generation cloud native database
Training on the device with MIT | 256Kb memory
基础—io密集型计算和cpu密集型计算
The correct way to set the bypass route
MySQL learning notes - SQL optimization of optimization
旁路由设置的正确方式