I have a linux (slackware) system with 1 gig of physical memory and 2 gigs of swap space. The system hasn't been rebooted in over a month, and it's been pretty stable. However, last few days, I've noticed that there's less and less free physical memory available - I think there's a memory leak in some piece of software I'm running, but I don't know how to find out which application is eating up all my memory.
If I do a top, I see several instances of mysqld and httpd, but the mysqld instances are (according to top) using only 1.8% of memory or less each, and the httpd instances are using only 0.8% or less each. This doesn't add up to the 80% or so memory usage I'm seeing. There are various other services running, but according to top they're only using between 0.1% and 0.4% of memory each.
Output from `cat /proc/meminfo`
Code:
total: used: free: shared: buffers: cached:
Mem: 926203904 881004544 45199360 0 74682368 641765376
Swap: 2147467264 0 2147467264
MemTotal: 904496 kB
MemFree: 44140 kB
MemShared: 0 kB
Buffers: 72932 kB
Cached: 626724 kB
SwapCached: 0 kB
Active: 206072 kB
Inactive: 493644 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 904496 kB
LowFree: 44140 kB
SwapTotal: 2097136 kB
SwapFree: 2097136 kB
Last time I checked (a few days ago), my free physical memory was twice what it is now. There's
something eating up my memory, but I don't know what.
The following software is used on this box:
- Apache 1.3.34
- PHP 4.4.2
- MySQL 5.0.18
- Courier IMAP 4.0.6
- Postfix 2.2.8
I also have a bunch of PHP scripts that I wrote myself that hit the db (MySQL) quite often, and I'm wondering if that could be responsible for my memory trouble. What I really need is a way to diagnose what's going on - is there a better way (other than top and meminfo) to find out which applications are using memory?
I'm worried that if this keeps up, eventually it's going to start hitting the swap (currently I'm not using any of the 2 gigs of swap space available), which will slow things down significantly.