Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-03-15
11:59 • Ticket [1157298fff] script demonstrates tk memory leak status still Closed w... artifact: a78b0badaa user: kylebateman
2005-03-10
11:30 • Ticket [1157298fff]: 4 changes artifact: 78360542c0 user: kylebateman
11:30 • Add attachment membug2 to ticket [1157298fff] artifact: 6a8f6418b2 user: kylebateman
11:30 • Ticket [1157298fff] script demonstrates tk memory leak status still Closed w... artifact: 9c96c01da2 user: kylebateman
2005-03-09
20:28 • Ticket [1157298fff]: 4 changes artifact: 5d3806038b user: kylebateman
02:17 • Closed ticket [1157298fff]. artifact: 64af5030d1 user: jenglish
01:56 • Ticket [1157298fff]: 4 changes artifact: f4d1c52ade user: hobbs
01:56 • Ticket [1157298fff]: 1 change artifact: eee4cf1351 user: hobbs
2005-03-05
22:18 • Add attachment membug to ticket [1157298fff] artifact: d7c58636ea user: kylebateman
22:18 • Ticket [1157298fff] script demonstrates tk memory leak status still Open wit... artifact: 4f86327f55 user: kylebateman
15:18 • New ticket [1157298fff]. artifact: 8a180d37e5 user: kylebateman

script demonstrates tk memory leak

Closed / Duplicate1157298fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-03-05 15:18:38
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?
kylebatemanplain2005-03-05 22:18:39
File Added - 124276: membug
hobbs Ticket [1157298fff]: 1 change [History diff]2005-03-09 01:56:57
hobbsplain2005-03-09 01:56:58
Logged In: YES 
user_id=72656

Didn't something similar come up before related to a
specific XFree version?
jenglishplain2005-03-09 02:17:50
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.
kylebatemanplain2005-03-09 20:28:51
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.
kylebatemanplain2005-03-10 11:30:32
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.
kylebatemanplain2005-03-10 11:30:33
File Added - 124950: membug2
kylebatemanplain2005-03-15 11:59:32
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.
Log in (anonymous is fine) to add a comment.

Attachments: