Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 27338 - xfree86 (xfree-4.3.0-r3) Memory Leak
Summary: xfree86 (xfree-4.3.0-r3) Memory Leak
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
: 50512 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-25 21:58 UTC by Evan Langlois
Modified: 2004-11-17 22:56 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Langlois 2003-08-25 21:58:38 UTC
I found my system getting incredibly slow, and realized that recently my X
process was using over 100MB of RESident memory with a VIRTual size of over
460MB!!  Thats a bit insane for a 256MB system that has very little running.

I tracked things down and created a test case running 2 Xservers on the same
box.  One stayed around 56MB of virtual memory, as did the other, until I ran
xawtv on one of them.  It consistently leaked memory, while the Xserver without
it didn't.  I think the reason for this is that I load the "v4l" module in
XF86Config to take advantage of hardware scaling when using my TV card and
ability to run the TV card on both heads of my dual-head setup, and full-screen
to both.

You can get more configuration options (and the channel thumbnails) without v4l,
but you only get 1 head, and no scaling.  With the v4l module, the TV card is
still used in overlay mode, only instead of writing directly to video memory, it
writes to an off-screen buffer, and v4l tells the video card to read the buffer,
scale it, and overlay it (via XVIDEO extension or something like that, I think).

Anyway, I think its leaking.  All I have to do is move a window on the screen
with xawtv running and the virtual memory size of X goes up, permanently.


Reproducible: Always
Steps to Reproduce:
Comment 1 Evan Langlois 2003-08-26 23:49:18 UTC
Hmm ... seems I was a bit hasty in my last description.  I'm not running xawtv, but my X process is still growing at an alarming rate.  Logging in as root doesn't seem to have this problem.  I can't seem to narrow this down.  I'd be happy to run  whatever tests you can think of.

Comment 2 Evan Langlois 2003-08-28 23:01:18 UTC
Root or no root has no effect - the more I use X the more it leaks.

Xfree86 4.3.0-r3
Kernel 2.6

mga driver (also have mga frame buffer on and it doesn't restore when switching back to teh console - seems to be a 2.6 thing).  The memory leak goes through 100MB in maybe an hour.  With 256MB of RAM, I swap too bad to stand it after 2 hours. 

HELP!
Comment 3 Chris Beauchamp 2003-09-08 07:29:50 UTC
Me Too </AOL>

Same Version of Xfree86

Same sort of size of memory usage.

However, no v4l module
Using Nvidia Driver (just one screen)
Don't use xawtv.

Seems to be worse when I leave Mozilla-Firebird open (including java processes), but is currently at 276Mb virtual memory with only normal Gnome stuff (panel, sawfish), xcreensave and a multi-gnome-terminal or two open.

256Mb Physical memory in an AMD Duron850Mhz machine.

Have re-emerged X and nvidia and Moz.

2.4 Kernel (gentoo-sources)
Comment 4 Seemant Kulleen (RETIRED) gentoo-dev 2003-09-12 08:46:48 UTC
chris, is it better with -r2?
Comment 5 Chris Beauchamp 2003-09-12 09:06:55 UTC
Will test and report back
Comment 6 Chris Beauchamp 2003-09-13 13:18:34 UTC
Have ebuilded xfree-4.3.0-r2 and tested for a day or two and found very little difference - still get large amounts of memory usage and a gradual loss of performance (too much swapping!)
Comment 7 Evan Langlois 2003-09-13 13:29:10 UTC
What about a magic sysrq-key to show all the memory and what process owns it?  Would this give any information that would be useable?  Or should I just link X with boehm's GC :)

Don't know what has done this, or what I changed to make it do this.  Or what my setup has in common with others that leak.
Comment 8 Chris Beauchamp 2003-09-13 13:52:29 UTC
Evan,

There must be some common factor between our two set-ups which is causing this... I have another machine here which also has 4.3.0-r2 installed on it and that has sat for days (or weeks) and X consumes about 80M! That machine is a PII 350Mhz, Nvidia TNT2 graphics.

Please post as much detail as possible (USE flags, compiler flags etc.) - there must be something we have in common!

I think we can eliminate kernel (2.6 vs 2.4) and graphics card (Nvidia vs MGA) so far...

Mine:

USE="X gtk gnome -alsa -kde -qt postgres crypt -java"
CHOST="i686-pc-linux-gnu"
CFLAGS="-mcpu=athlon -O3 -pipe"
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS="~x86"

Chris
Comment 9 Evan Langlois 2003-09-13 18:37:53 UTC
Yeah - I've run 2.6 and 2.4 - same problems.

My USE flags are crazy ...

USE="3ds acl amd apache2 ardour-ksi bindist bots cscope curl dga dnd dvd \
     ethereal evms2 evo fbcon fbdev flash fluidsynth freetds gb gd \
     gd-external ginac gmtfull gmthigh gmtsuppl gmttria gnomedb gphoto2 \
     gstreamer gtk2 hbci imagemagick innodb jack jack-tmpfs jikes justify \
     ladcca lcms libdsk libgda libww lids lirc ltsp maildir matroska \
     matrox mcal md5sum mdb memlimit mng moznoirc moznomail mozsvg mpi \
     music oav objc oci8 odbc offensive ofx openal parse-clocks pda pic \
     plotutils pnp ppds prebuilt prelude qhull samba sasl scanner slp sox \
     sqlite stroke threads tiff transcode trusted type1 usb v4l vim-with-x \
     wmf wx wxwindows Xaw3d xinerama xosd xvid zeo -arts"
CHOST="i586-pc-linux-gnu"
CFLAGS="-march=k6-2 -O3 -fomit-frame-pointer -pipe"
CXXFLAGS="${CFLAGS}"
ACCEPT_KEYWORDS="~x86"

/etc/fstab entries that could be relevant ...

none                    /proc           proc            defaults 0 0
none                    /dev/shm        tmpfs           defaults 0 0

/etc/X11/XF86Config entries (partial file) :
Section "ServerLayout"
        Identifier      "Xinerama"
        Screen          0 "Screen0" 0 0
        Screen          1 "Screen1" RightOf "Screen0"
        InputDevice     "Mouse0" "CorePointer"
#       InputDevice     "Mouse1" "AlwaysCore"
        InputDevice     "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerFlags"
  Option "Xinerama" "true"
EndSection

Section "Files"
        RgbPath      "/usr/X11R6/lib/X11/rgb"
        FontPath "/usr/X11R6/lib/X11/fonts/100dpi"
        FontPath "/usr/X11R6/lib/X11/fonts/75dpi"
        FontPath "/usr/X11R6/lib/X11/fonts/CID"
        FontPath "/usr/X11R6/lib/X11/fonts/Speedo"
        FontPath "/usr/X11R6/lib/X11/fonts/TTF"
        FontPath "/usr/X11R6/lib/X11/fonts/Type1"
        FontPath "/usr/X11R6/lib/X11/fonts/cyrillic"
        FontPath "/usr/X11R6/lib/X11/fonts/encodings"
        FontPath "/usr/X11R6/lib/X11/fonts/freefont"
        FontPath "/usr/X11R6/lib/X11/fonts/lfp-fix"
        FontPath "/usr/X11R6/lib/X11/fonts/lfp-var"
        FontPath "/usr/X11R6/lib/X11/fonts/local"
        FontPath "/usr/X11R6/lib/X11/fonts/misc"
        FontPath "/usr/X11R6/lib/X11/fonts/sharefont"
        FontPath "/usr/X11R6/lib/X11/fonts/truetype"
        FontPath "/usr/X11R6/lib/X11/fonts/ukr"
        FontPath "/usr/X11R6/lib/X11/fonts/util"
        FontPath "/usr/X11R6/lib/X11/fonts/ukr"
        FontPath "/usr/X11R6/lib/X11/fonts/util"
        FontPath "/usr/X11R6/lib/X11/fonts/xawtv"
        FontPath "/usr/X11R6/lib/X11/fonts"
EndSection
Section "Module"
        Load  "GLcore"
        Load  "v4l"
        Load  "dbe"
        Load  "dri"
        Load  "extmod"
        Load  "fbdevhw"
        Load  "glx"
        Load  "record"
EndSection

Section "Device"
        Identifier  "Matrox G400"
        Driver      "mga"
        VendorName  "Matrox Graphics, Inc."
        BoardName   "MGA G400 AGP"
        BusID       "PCI:1:0:0"
        Option      "AGPFastWrite" "True"
        Option      "OverclockMem" "On"
        Option      "AGPMode" "x4"
        Option      "EnablePageFlip" "True"
EndSection

Section "Device"
    Identifier  "Matrox Millennium"
    Driver      "mga"
    VendorName  "Matrox Graphics, Inc."
    BoardName   "MGA 2064W [Millennium]"
    BusID       "PCI:0:9:0"
    VendorName  "Unknown"
    BoardName   "Unknown"
    # VideoRam    2048
    Option  "sw_cursor"
    # Insert Clocks lines here if appropriate
EndSection


A friend's laptop is using x11-base/xfree-4.3.0-r3 without this problem - its been used downstairs pretty heavily for almost a week without being logged out, and its at 50MB virtual and 37MB resident - not too far from what mine reads when I first log in.

I don't know if I had this problem when the system was installed - but I really don't think so.  I'm pretty sure it was fine, and I don't know when it started.

APPLICATIONS (current version in [xxx] - its an emerge output, showing flags):

[ebuild   R   ] x11-base/xfree-4.3.0-r3  -3dfx -sse +mmx -3dnow +xml2 +truetype +nls -cjk -doc -ipv6 -debug -static
[ebuild     U ] gnome-extra/gconf-editor-2.4.0 [0.4.1]
[ebuild     U ] x11-libs/gtk+-2.2.4-r1 [2.2.1-r1] -doc +tiff +jpeg
[ebuild     U ] gnome-base/gnome-applets-2.4.0 [2.2.2] -doc +apm -ipv6
[ebuild     U ] x11-terms/gnome-terminal-2.4.0.1 [2.2.2]
[ebuild     U ] gnome-base/gnome-session-2.4.0 [2.2.2] -ipv6
[ebuild     U ] gnome-extra/gnome-media-2.4.0 [2.2.2] +oggvorbis +mad
[ebuild     U ] x11-themes/gnome-icon-theme-1.0.9 [1.0.6]
[ebuild     U ] media-gfx/eog-2.4.0 [2.2.2] +jpeg
[ebuild     U ] x11-wm/metacity-2.6.1 [2.4.55]
[ebuild     U ] gnome-base/libgnome-2.4.0 [2.2.3] -doc
[ebuild     U ] gnome-base/gnome-2.4 [2.2.1] +cdr -doc
[ebuild   R   ] net-nds/openldap-2.0.27-r4  +ssl +tcpd +readline -ipv6 +berkdb +gdbm -kerberos +odbc

I used to run gdm, but am using qingy now, so gdm wasn't the problem.
Comment 10 Chris Beauchamp 2003-09-14 06:02:24 UTC
Nothing obvious there...

/etc/fstab is the same

XF86Config (rearranged to match)

Section "ServerLayout"
    Identifier  "Simple Layout"
    Screen "Screen 1"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection

Section "ServerFlags" 
EndSection 

Section "Files"
    RgbPath	"/usr/X11R6/lib/X11/rgb"
    FontPath   "/usr/X11R6/lib/X11/fonts/local/"
    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath   "/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "Module"
    Load        "dbe"  	# Double buffer extension
    SubSection  "extmod"
    EndSubSection
    Load        "type1"
    Load        "freetype"
    Load       "glx"
EndSection

Section "Device"
    Identifier  "nv"
    Driver      "nvidia"
EndSection


Not entirely sure what command  you did to get the package listing, however emerge -pv xfree gives:

[ebuild     U ] x11-base/xfree-4.3.0-r3 [4.3.0-r2] -3dfx -sse +mmx +3dnow +xml2 +truetype +nls -cjk -doc -ipv6 -debug -static 

I use gdm :-)

Comment 11 Evan Langlois 2003-09-18 17:52:28 UTC
Well, I'm gonna re-emerge X, and see what happens.  I'll let you know in a few days when the emerge finally finishes.  
Comment 12 Evan Langlois 2003-09-21 23:13:14 UTC
Re-emerging with different flags and such doesn't work, but this does :

[4.3.99.12] -3dfx -sse +mmx +3dnow +xml2 +truetype +nls -cjk -doc -ipv6 -debug -static

I do however get some errors on start-up about fonts, and DRI (still) doesn't seem to work with Xinerama (or is it another issue?), and my MTRRs (still) aren't set up properly ...

mtrr: no MTRR for e0000000,800000 found
mtrr: 0xe0000000,0x2000000 overlaps existing 0xe0000000,0x1000000

But ... the memory leak seems to have gone away, so upgrading was a gain in at least 1 area!

Will 4.4 give me a cleaner start-up, cure the mtrr woes, and give me DRI?  Only time will tell.  No crashes and disk thrashing is a good start.  I'm right around 64MB of virtual memory for X, and when you remove the mmap'ed RAM of both cards, that isn't too bad.  Anything that doesn't grow isn't too bad!

-- TARO!
Comment 13 Chris Beauchamp 2003-10-14 02:45:31 UTC
tried compiling 4.3.99.13, with similar use flags, and still had the same
problem!
Comment 14 Evan Langlois 2003-10-14 22:09:19 UTC
What about 4.3.99.12?  If .12 works ok, and .13 doesn't, then maybe there
is some patch that was added in to .13 from the stable branch that is causing
the problem.    I'd try .13 myself, but I've been using my home system for
a developement box to compile code for another system, so everything is a
little out of whack.  In the future I'll be using the new developement box
at work, for home stuff as well, so recompiling different versions of stuff
will be alot easier for me (Quad Xeon, 1GB RAM, SCSI RAID).  I'm going to
write a simple make.conf switcher with a front-end for emerge so I can develope
for different systems (including my Zaurus).
Comment 15 Arne-Kolja Bachstein 2003-10-25 12:39:01 UTC
aaaah, just committed bug #31982, seems to be the same. however, i found
out whats wrong: turn off the xcursor theme (!)
Comment 16 Andrew Bevitt 2003-11-23 20:03:56 UTC
Do either of you Chris or Evan use the fancy cursors? Or are you using the core pointer, simple black arrow? 

Are the video (mga and nvidia) drivers the standard X ones or extra packages?
Comment 17 Andrew Bevitt 2004-05-09 20:22:39 UTC
*** Bug 50512 has been marked as a duplicate of this bug. ***
Comment 18 Evan Langlois 2004-05-10 13:01:30 UTC
*** Bug 50512 has been marked as a duplicate of this bug. ***
Comment 19 Donnie Berkholz (RETIRED) gentoo-dev 2004-09-30 13:52:29 UTC
Try xrestop
Comment 20 Donnie Berkholz (RETIRED) gentoo-dev 2004-11-17 22:56:36 UTC
Please reopen if you respond to comment #16 and comment #19.