当前位置:网站首页>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
边栏推荐
- 基于K-means的用户画像聚类模型
- 信标委云原生专题组组长,任重道远!
- 【单体】流辰信息I-BPSv3服务器推荐配置
- CNN convolution neural network principle explanation + image recognition application (with source code) [easy to understand]
- 为什么数字化转型战略必须包括持续测试?
- String type conversion BigDecimal, date type
- BlocProvider 为什么感觉和 Provider 很相似?
- AIDL基本使用
- MySQL清空表数据
- Qtreeview+qabstractitemmodel custom model: the third of a series of tutorials [easy to understand]
猜你喜欢
Pytest collection (2) - pytest operation mode
多种智能指针
"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
工控设备安全加密的意义和措施
What is the difference between PMP and NPDP?
【直播回顾】战码先锋首期8节直播完美落幕,下期敬请期待!
Talking from mlperf: how to lead the next wave of AI accelerator
Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
Basic operation of binary tree
Why does blocprovider feel similar to provider?
随机推荐
基于三维GIS的不动产管理应用
What is the difference between PMP and NPDP?
An operation tool used by we media professionals who earn 1w+ a month
Smart micro mm32 multi-channel adc-dma configuration
【MySQL】索引的创建、查看和删除
require与import的区别和使用
What is the difference between consonants and Initials? (difference between initials and consonants)
Use of vscode
linux下清理系统缓存并释放内存
Simple interactive operation of electron learning (III)
matlab遍历图像、字符串数组等基本操作
【STM32】STM32CubeMX教程二–基本使用(新建工程点亮LED灯)
MQ学习笔记
按照功能对Boost库进行分类
100年仅6款产品获批,疫苗竞争背后的“佐剂”江湖
MQ learning notes
Make a three digit number of all daffodils "recommended collection"
AirServer手机第三方投屏电脑软件
Go — 相关依赖对应的exe
Qtreeview+qabstractitemmodel custom model: the third of a series of tutorials [easy to understand]