开发者

How to tell where the memory went in Linux

开发者 https://www.devze.com 2023-01-23 10:26 出处:网络
I have a long running process that I suspect has a memory leak.I use top to monitor the memory levels of each process and nothing uses more than 15% of the total RAM.The machine has 4GB of RAM and the

I have a long running process that I suspect has a memory leak. I use top to monitor the memory levels of each process and nothing uses more than 15% of the total RAM. The machine has 4GB of RAM and the process starts with well over 3GB free. The process itself does very heavy, custom calculations on several MB of data. It takes a single core at 100%.

As time goes on, memory disappears but top does not blame my long running process. Instead, the "cached" and "buffers" memory increases and the "free" memory is reduced to as low as 2MB. The process 开发者_开发知识库eventually finishes its job and exits without issue but the memory never comes back. Should I be concerned or is this "normal"? Are there other tools besides top that can provide a deeper understanding?

Thanks.


That's normal. Your process is operating on files which are getting cached in memory. If there is "memory pressure" (demand from other programs) then that cache memory will be relinquished. The first time I wrote an X widget to show how much memory was "free" it took me a while to get used to the idea that free memory is doing you no good: Best to have it all in use doing some kind of caching until it's needed elsewhere!

0

精彩评论

暂无评论...
验证码 换一张
取 消