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

Neal McBurnett neal at bcn.boulder.co.us
Sun Dec 30 18:36:14 MST 2001


On Sun, Dec 30, 2001 at 01:51:05PM -0700, D. Stimits wrote:
> 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.

My memory was tied up in the X server, not xscreensaver itself.
But as soon as I killed xscreensaver, the server's total memory
size dropped sharply and stayed at a level 77 MB less.

It would seem like a similar strategy to efence could help.  But
offhand the info at
 http://sources.isc.org/devel/memleak/efence.txt

doesn't suggest that efence would track usage of X11 library calls by
an X11 client that tie up memory on the server rather than the local
process.

It would seem much more appropriate for the problem I'm tracking to
just have some code in the X server that tracks down how much memory
is used by each client.  Even if a true memory leak is not involved,
it would be nice to know which clients are tying up the most memory
when you're in a crunch.  Having to figure out which clients are
connected and how to start each one up via a tool like efence would be
a big hassle, especially for clients that some other process starts
like the gnome panel.

Anyway, thanks for the insights.

Neal McBurnett <neal at bcn.boulder.co.us>
http://bcn.boulder.co.us/~neal/
GPG/PGP signed and/or sealed mail encouraged.  Keyid: 2C9EBA60


> 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
> _______________________________________________
> 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