[lug] x server memory usage and indirect xscreensaver memory leak

D. Stimits stimits at idcomm.com
Sun Dec 30 13:51:05 MST 2001


Something else that might throw a wrench in your measurements is that
the reported memory use includes the actual video card memory. So if you
use the video card memory on a 3D app, and you have a 32 MB card, you
might see top reporting a total memory of your real ram plus 32
mysterious MB. I do not know if ps can distinguish between video and
system memory. If you measure while the actual screensaver is running,
it might not be entirely what you expect (but then again, it might be).

On another note, if you use an opengl screensaver and have hardware
accel enabled, and then if the screensaver is badly written and it
crashes, it can easily kill the X session, or even lock up the machine.
I have noticed a large number of screen savers will core dump/seg fault
on me at one time or another (I'm using SMP, this might change things as
to how often it core dumps/seg faults). The very presence of a seg fault
means that something is not right with the memory management of the
screensaver, I would not be the least bit surprised if you have found a
genuine memory leak. If it is a C app, you can get the electric fence
library, and rebuild the app linking with -lfence (I think that is the
link, maybe it was -lefence). Anyway, get electric fence, read the man
page, it is easy to use. Then run the screen saver from the command
line, efence should tell you about possible leaks and bad memory code.
I'd like to see it work with C++ new and delete as well, I don't think
it works for those though.

D. Stimits, stimits at idcomm.com

Neal McBurnett wrote:
> 
> My machine was running very slowly because I was using a lot
> of swap space because my X server process was using 120 MB of
> total memory.  Well, I had been running it for 56 days....
> 
> I watched the size for a while with
> 
>       while true; do
>              ps -o s,uid,pid,ppid,vsz,stime,tty,time -p11729 | grep -v UID
>              sleep 30
>       done
> 
> and started deleting processes, and discovered that xscreensaver was
> tying up about 77 MB of X server memory.  Looks like a memory leak there
> (I ran in 'random' mode, so it could be any of the screensavers....)
> 
> [redhat 7.1, xscreensaver-3.29-3]
> 
> The screensaver itself at the time was using very little memory
> (perhaps 3 MB).
> 
> My question is, is there a better way to track down this sort
> of problem?  E.g. a command to query the server to find out
> which connections are using how much memory?  Or a simple data
> structure to look at with gdb on the X server?
> 
> Cheers,
> 
> Neal McBurnett <neal at bcn.boulder.co.us>
> http://bcn.boulder.co.us/~neal/
> GPG/PGP signed and/or sealed mail encouraged.  Keyid: 2C9EBA60
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list