Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I run watch free and then observe a continuous memory used increment, about 100 every 2s. How can I know which process contribute to the used memory increment?

top and pmap does not help.

BTW, after I run echo 1 > /proc/sys/VM/drop_caches, the used memory decreased drastically. But it still keep increasing with the same rate.

share|improve this question
    
'100 every 2s' ... 100 of what? –  akira Sep 27 '11 at 7:53
    
@akira: free reports kbytes by default, so probably "100s of kbytes". –  David Andersson Dec 16 '11 at 17:15
1  
To verify that it is a real leak and not caches/buffers: After "echo 1 > /proc/sys/VM/drop_caches", does it drop to the about the same lower value each time, or to a higher value each time? In the output from "free", does the value of "+/- buffers/cache" constantly increase, or only the value of "Mem"? –  David Andersson Dec 16 '11 at 17:23
add comment

1 Answer

I would use top and hit shift-m to sort on memory. If an app is leaking memory it's %MEM should be increasing and the number under the RES column should be going up.

Above the list of the processes, if your free is going down, but buffers and cache are going up, while the apps in the list are about the same, then you should be fine. This just means Linux is using your free RAM to avoid hitting your hard disk and such so it can run faster. If you're worried about it still, open a bunch of applications and Linux should lower how much space it's using for the cache and buffers as the free gets close to 0.

When you tell it to drop_caches, Linux probably has to re-read the same area of the hard disk it just un-cached, and re-caches it. We might be able to figure out how to limit the cache size if you really want to, but Linux is using your unused RAM to speed stuff up. Unless this is a laptop and you're trying to conserve power, you want it to use your RAM so it runs fast.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.