This demonstration script shows that if you clear a
listbox, change its cursor, reload it with new
contents, and then change the cursor back, you can
produce a memory leak.
This leak manifests itself not in the program space
itself but in the size of the X server the program is
running under. In the simplest case, the program can
be exited and, although the X server does not shrink,
it does seem to use the memory again on the next run of
the script. (You need to press the Reload button more
times than last time to see the server start growing
again.)
However in the case of a remote X server (X -query
host), the problem is even worse: The server never
seems to get the memory back at all: i.e. each new run
of the program will start the X server growing ever larger.
I've tested this on:
OS (Linux): Fedora 1 and Fedora 3
X: XFree86 4.3.0 and xorg 6.8.1
TCL/TK: 8.3.5 and 8.4.7
Anyone willing/able to test this on current rev and see
if it is still a problem?
File demonstrating memory leak
Logged In: YES
user_id=72656
Didn't something similar come up before related to a
specific XFree version?
Logged In: YES
user_id=68433
This is a duplicate of #918052 "Memory leak connected to
X11, Tk and an XCursor theme".
The leak is in the X server, not in Tk, although Tk CVS HEAD
still triggers the leak. It only shows up if certain
"cursor themes" are in use.
Logged In: YES
user_id=316877
Hmm. I don't really know what a "cursor theme" is (yet).
But I'm using stock Fedora 3. Anyone know some cursor
themes that are "safe"?
Maybe people could work around this bug by installing the
right theme for now.
Logged In: YES
user_id=316877
OK, it looks like fedora 3 uses a cursor theme that is part
of Redhat's overall Bluecurve theme. It would be nice to
disable that and test native X11 cursors, but I haven't
figured out how to do that yet. Anyone know how?
I also tested the leak.c program provided in #918052. This
does produce a leak, but once the application dies, the X
server goes back to its previous size. With the test
application I provided, the X server never shrinks--even
after the app finishes or is killed.
I also made a simple TK app as suggested in #918052
consisting only of iterations of setting the cursor. This
program does indeed leak too and it leaves the X server big
when it terminates. The difference is: If you then run it
again with a smaller number of iterations, and let it
terminate naturally, it will shrink the X server back down
again. Strange!
I'll post this example here as membug2.
Another test case
Logged In: YES
user_id=316877
OK, here's a workaround that will stop the leak:
cd /usr/share/icons/default
mv index.theme index.theme.save
This seems to disable the Xcursors extension, reverting X
back to its native cursors.
I tried a number of other alternate cursor themes. All I
tried still showed nearly identical leak characteristics.
Disabling the extension altogether is the only way I have
found to stop the leak.