[KLUG Members] Memory dump?

Peter Buxton members@kalamazoolinux.org
Thu, 11 Dec 2003 01:03:14 -0500


On Wed, Dec 10, 2003 at 07:46:20PM -0500, copycon was only escaped
   alone to tell thee:

> I am running RH9 with the KDE desktop I have 368mg of RAM and I run KDE
> system gaurd to monitor the system and the memory just keeps increasing
> like thier is a leak or that it is not being released back to the system
> after a program is closed it gets to the point were programs wont even
> open anymore and I have to reboot this usually takes about 8 days 

I'm assuming you've already used `ps afx` to look for zombie processes.
And from what you wrote, this isn't a simple "disk cache buffers
mistaken for program-assigned memory" error. And I take it top(1),
sorted by memory, isn't showing you enough history to spot the offenders

ps axv | sort -n -k 8

Merely set up a cron job to run that every 4 hours or so and save the
results to files named like this:

FILE_NAME=`date +%F_%X`

Don't save to /tmp, it gets erased every reboot.

ps(1) has very messy output, though. Another method:


#! /bin/sh

PDIR=/root/`date +%F_%H.%M`
mkdir $PDIR
cd $PDIR

for i in $( find /proc/ -maxdepth 1 -name [1-9]\* )
   do
   STATFILE="${i}/status"
   if [ -a $STATFILE ] && [ ! /proc/self -ef $i ]
      then
      # Note that /Pid: / contains a TAB, not a SPACE (Ctrl-v, TAB)
      OUR_OUT=`grep ^Pid: $STATFILE | sed 's/Pid:       //'`
      grep -E '(^Name|^Vm)' $STATFILE > $OUR_OUT
   fi
done

exit


You're going to record a lot of transient PIDs, of course, but they
should not be the memory leak offenders.

-- 
[The Basement Tapes were] like the Watergate tapes... Bob
would say, 'We should destroy this.' -- Robbie Robertson