Xorg memory leak

Coleman Kane cokane at FreeBSD.org
Wed Jan 2 15:00:54 PST 2008


Peter Jeremy wrote:
> On Wed, Jan 02, 2008 at 11:26:33AM -0500, Coleman Kane wrote:
>   
>> I'm running into some weird problem where the memory usage of Xorg will
>> keep increasing and increasing as time goes on. I first noticed teh
>> problem when I had a long-running process inside of gnome-terminal that
>> was constantly dumping lines of data to stdout. Eventually the memory
>> usage of the Xorg process would spiral out of control (Virtual Size in
>> excess of 6GB). Upon reaching maximum memory utilization, X clients
>> begin to die with BadAlloc errors and the only way to fix the problem is
>> to stop Xorg and then restart it.
>>     
>
> This could also be caused by a resource leak or deliberate action by a
> client.  Firefox in particular will "cache" all images in the X server
> and this can make the X server bloat alarmingly (though the biggest
> size I've seen is 1.5GB).
>
> Have you tried exiting from long-running clients to identify if the
> problem is on the server or client side?
>   
Yeah, I've tried exiting. I noticed it while doing some tests with
sphinx3, using the live decoder (sphinx3 doesn't use X11 at all) from a
gnome-terminal. I have tried killing off all gnome-terminals and all
gnome-pty-helper sessions that are still open, in hopes that it would
alleviate these troubles. It does seem to be caused generally by all
applications, but I seem to have enough control over gnome-terminal to
play around with the effect.

I tried the following:
Start a gnome-terminal.

cat /dev/random (spewing lines upon lines of random garbage to the screen)

It seems that while my terminal window remains relatively small (around
80x30 characters), there doesn't seem to be any impact. However, if I
drag the window border to expand the size of it (to like 220x70 or
something), then it starts to chew up memory from the Xorg process. It
can sometimes get so bad as to take ~100MB per second at times. Normal
xterm does not seem to exhibit this behavior. One thing that I've
noticed is that the memory-eating seems to coincide with the point where
the gnome-terminal window's redraw rate starts to lag from the window
being far too large. Switching virtual terminals back-and-forth with
Firefox and/or Thunderbird running also causes the memory-consumption to
occur, but not quite as quickly as my gnome-terminal experiment.

For instance, my Xorg server line from top when starting this message is:
56761 cokane           1  51    0  2050M   565M select 1  21:20  9.57% Xorg

Now that I've played with gnome-terminal, I have the following:
56761 cokane           1  49    0  3545M  1074M select 0  22:54  4.49% Xorg

It won't go back down until Xorg is actually closed.

--
Coleman



More information about the freebsd-x11 mailing list