#1676 Memory leak connected to X11, Tk and an XCursor theme

obsolete: 8.4.4
open
Joe English
5
2004-09-24
2004-03-17
Petr Pajas
No

I'm experiencing memory leaks in Tk-based applications
(such as demos/widget) running under X11 on SuSE
Linux 9, XFree86-4.3.0.1-46 and tk-8.4.4-57. I
discovered it only exhibits in connection with a XCursor
theme installed in .icons, but apparently not necessarily
with an arbitrary theme. So far I noticed the problem
only in connection with a theme called Siver, which can
be found at
http://www.kde-look.org/content/show.php?content=5533

The leak appers in the X process, not the Tk applications
themselves but other toolkits, like Gtk or Qt are not
affected by this. To reproduce it, install the Silver
XCursor theme and do the following:

1) run widget demo: /usr/lib/tk8.4/demos/widget

2) run top and press M to sort processes by memory
usage

3) move mouse pointer over links in the widget main
window for a while
(may take some time for the first time, but generally not
longer than
a minute - the loger )

4) watch the X process memory in top. On my setup it
grows by about
1MB/5 sec.

Petr

Discussion

  • Don Porter
    Don Porter
    2004-03-18

    Logged In: YES
    user_id=80530

    report mentions the widget demos,
    so I'll make that the first guess for
    the Category.

     
  • Don Porter
    Don Porter
    2004-03-18

    • labels: --> 318661
    • milestone: --> obsolete: 8.4.4
    • assigned_to: nobody --> dkf
     
  • Logged In: YES
    user_id=79902

    The widget demo main window is just a text widget with a few
    trivial (in this aspect) bindings that switch between having
    a specified cursor (i.e. non-empty -cursor option) and an
    unspecified one.

    Classing as a [text] bug, but I suspect the problem is
    elsewhere. Assigning to someone who knows X11 better than I do.

     
    • labels: 318661 --> 104346
    • assigned_to: dkf --> jenglish
     
  • Joe English
    Joe English
    2004-04-04

    Logged In: YES
    user_id=68433

    Can't easily replicate here. Any Tk developers who use KDE?

     
  • Joe English
    Joe English
    2004-04-04

    Logged In: YES
    user_id=68433

    More information: X cursor themes are apparently implemented
    by the XCursor extension and a corresponding client library
    libXcursor.a. Tk has no direct support for libXcursor (I
    didn't even know it existed until today ...); I'd guess that
    the problem is *probably* somewhere in the cursor theme,
    unless maybe Tk is making assumptions about built-in cursors
    that aren't valid in the presence of this extension.

    Hard to say much more; there seems to be very little
    information on the Web about XCursor.

     
  • Don Porter
    Don Porter
    2004-09-23

    Logged In: YES
    user_id=80530

    I can't confirm personally,.but I'm
    hearing reports from users that
    this leak is present (and hits hard!)
    on the default Fedora 2 configuration.

    All that's needed to produce the
    leak, it seems, is iterations of:

    . configure -cursor watch
    . configure -cursor {}

    As noted in earlier comments, the
    leak is in the X server process,
    not the Tk process.

     
  • Don Porter
    Don Porter
    2004-09-24

    Logged In: YES
    user_id=80530

    Perhaps related trouble that I can confirm:

    $ make runtest
    ...
    % testcursor watch
    Segmentation Fault

     
  • Don Porter
    Don Porter
    2004-09-24

    Logged In: YES
    user_id=80530

    No, that just a missing initialization
    in the debug routine. committing
    fix just for that...

     
  • Don Porter
    Don Porter
    2004-09-24

    • labels: 104346 --> 31. Cursor Names
     
  • Don Porter
    Don Porter
    2004-09-24

    Logged In: YES
    user_id=80530

    Attached is a C program independent
    of Tcl and Tk. Build it with:

    gcc leak.c -o leak -L/usr/X11R6/lib -lX11

    (modify as needed for your system), and
    then try a run of:

    leak 5000

    Watch the X process for leaking memory.
    Choose smaller numbers of iterations
    for safety to avoid crashing X, then get
    larger until you see a leak or are satisfied
    this program doesn't have one.

    I expect this program to leak, and demonstrate
    that the bug here is in the X server, not in Tk.
    Perhaps this demo program will be of help
    to the X server programmers in fixing their bug.

     
  • Don Porter
    Don Porter
    2004-09-24

     
    Attachments
  • Joe English
    Joe English
    2004-09-24

    Logged In: YES
    user_id=68433

    Confirmed: while 'leak' is running, the X server process
    size grows (seemingly without bounds). Once the client
    exits, though, the X server quickly shrinks back to its
    original size according to 'ps -l'.

    This is on Debian testing, XFree86 4.3.0, Gnome 2.6 (which
    uses an XCursor "cursor theme", but I'm not sure which one.)

     
  • Joe English
    Joe English
    2005-03-08

    Logged In: YES
    user_id=68433

    See also: #1157298