gitalk icon indicating copy to clipboard operation
gitalk copied to clipboard

谁吃了我的Linux内存?

Open utterances-bot opened this issue 2 years ago • 1 comments

谁吃了我的Linux内存?

一个经常被问的Linux问题:为啥我的Linux系统没运行多少程序,显示的可用内存这么少?其实Linux与Win的内存管理不同,会尽量缓存内存以提高读写性能,通常叫做Cache Memory。 比较老的文件都会介绍Linux的cache占用很多没关系,因为Linux尽可能利用内存进行缓存,但是缓存的回收也是需要

https://colobu.com/2017/03/07/what-is-in-linux-cached/

utterances-bot avatar Mar 15 '23 06:03 utterances-bot

pcstat 还是有一些问题的,比如只是通过 /proc/{pid}/maps 扫描进程的文件描述符,不能实现全局的 page cache 扫描,不能排序输出,也不能遍历子目录,不支持并发扫描等等

我这边参考 pcstat 的逻辑,重构了加强版的 page cache 分析工具,有兴趣的可以看看。

https://github.com/rfyiamcool/pgcacher

rfyiamcool avatar Mar 15 '23 06:03 rfyiamcool