0

I'm having trouble finding from where this memory leak is occurring. I'm running Ubuntu 8.04 LTS on a Dell XPS M1530. I have 3GB of ram and I'm finding after about an hour or so of use top shows me 2GBs+ used. The strange thing is when I add up the memory percentages by PID either from top or ps aux I find that I should only be using about 20-25% of my available ram.

What brought this to my attention was I've begun running vmware server again. Now, obviously the ram usage spikes when I load a virtual machine, but the memory VMware is using does not account for the memory usage I'm seeing via top or free. Stopping vmware server releases the memory which was allocated to it, but I'm still unable to find where this RAM is being used. After a complete reboot, of course, the memory is fine, but very quickly it climbs to 60-80% usage with the processes only appearing to account for a third of that. Any ideas where I should look for more information on what this could be?

4 Answers 4

3

Are you using your swap at all?

If not I wouldn't worry. Linux likes to use spare memory to cache disk blocks.

If you're convinced you actually have a memory leak, I'd investigate the drivers you're using. Binary-only drivers are hard to debug so I would expect them to maybe have leaks.

2
  • Well, here's the odd part. It's not using the swap space, however it's becoming obnoxiously sluggish, sometimes even refusing to load new programs when the memory usage is extremely high and yet it doesn't dip into the swap. Doesn't make much sense to me, but thanks for the tip.
    – Karl
    Mar 25, 2010 at 11:17
  • Looks like I couldn't find a real memory leak, so it must just be the disk caching. Thanks for the help!
    – Karl
    Mar 25, 2010 at 15:20
1

Congratulations, it's the same "bug" that "hurt" Windows 7 users :) Linux uses (and did so for at least the last ten years) the unused RAM to cache disks and buffer various data. Microsoft recently realised it's a helluva good idea, and many people complained about this recently. Search for "windows 7 memory leak" for fun :)

1
  • 2
    Windows Vista, actually.
    – Sathyajith Bhat
    Mar 24, 2010 at 20:42
1

Check out your "real" memory usage with the command "free". Note that linux keeps stuff in memory as long as possible, since you might use it again. Thereby it creates a big cache/buffer usage of memory.

Edit in response to Keeners comment:

             total     used     free   shared  buffers   cached
Mem:       4058084  3974976    83108        0    89152  3520952
-/+ buffers/cache:   364872  3693212
Swap:      2040212   157048  1883164

Did you check the line "-/+ buffers/cache" (which i doubt you can see this clear in top), did you than still have very little space free in that line? Because as you can see in my example that's the "real" free memory whereas in the first line or in top you only see a pretty useless value for free. Now I just want to make sure you understand the output, because if you already looked at free as you said, you would have seen you don't have a leak and your machine is just caching like you say in your final comment to the solution.

3
  • Free returns the same results as top as I said above.
    – Karl
    Mar 25, 2010 at 11:13
  • @Keener - did you use the tool "free" and looked at the "-/+ buffers/cache"-line like discribed in the edit of my post above?
    – snies
    Mar 26, 2010 at 9:44
  • Yes, I did look at the 'free' tool. The issue was I didn't know that *nix cached so much to ram, so I assumed it was a memory leak and I see now the error of my assumptions. Thank you for the help!
    – Karl
    Mar 26, 2010 at 12:27
1

You can try the command below to free the cache without restarting the server. Check with top before and after the command.

echo 1 > /proc/sys/vm/drop_caches

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .