Tk Source Code

View Ticket
Login
2026-10-18
13:47 • Closed ticket [5f7ba8c5]: Leakage in trunk, with --disable-xft build plus 7 other changes artifact: 08d3f9a2 user: nemethi
13:28
Fix [5f7ba8]: only record windows belonging to an embedded toplevel in the deletedWinTable check-in: 7f1d1aff user: csaba tags: core-8-6-branch
2026-10-15
14:20
Fix [5f7ba8]: only record windows belonging to an embedded toplevel in the deletedWinTable check-in: 6d2a074b user: jan.nijtmans tags: core-9-0-branch
10:39
Fix [5f7ba8]: only record windows belonging to an embedded toplevel in the deletedWinTable check-in: 372a3d9e user: jan.nijtmans tags: trunk, main
2026-10-14
14:20
Folllow-up for fix [5f7ba8c5a3]: Leakage in trunk, with --disable-xft build check-in: 7e7e736d user: csaba tags: core-8-6-branch
14:19
Folllow-up for fix [5f7ba8c5a3]: Leakage in trunk, with --disable-xft build check-in: baa83b26 user: csaba tags: core-9-0-branch
11:58
Fix [5f7ba8c5a3]: Restore the fix for [4a25f316f7] check-in: 474ec9d0 user: csaba tags: core-8-6-branch
09:22
Fix [5f7ba8c5a3]: Restore the fix for [4a25f316f7] check-in: d5effc94 user: csaba tags: core-9-0-branch
2026-10-11
12:02 • Ticket [5f7ba8c5] Leakage in trunk, with --disable-xft build status still Open with 3 other changes artifact: eb85a35a user: serhiy.storchaka
12:01
Fix [5f7ba8c5a3]: after an embedded toplevel had been created, every destroyed window was recorded until the server processed the requests made before its deletion, so memory tests (entry-5.20, place-14.1) saw growth when run after embed.test. Only the windows of an embedded toplevel can be destroyed by the container: record only them. Test unixEmbed-12.1. closed check-in: bd088fc4 user: serhiy.storchaka tags: deleted-windows-embedded-only
2026-10-10
21:47
Folllow-up for fix [5f7ba8c5a3]: Leakage in trunk, with --disable-xft build check-in: 74f808aa user: jan.nijtmans tags: trunk, main
2026-10-09
18:11 • Ticket [5f7ba8c5] Leakage in trunk, with --disable-xft build status still Open with 3 other changes artifact: 67ab5251 user: serhiy.storchaka
18:11
Fix [5f7ba8c5a3]: deleted X error handlers were kept until every 10th deletion, and then only those processed before the previous round trip were freed, so memory tests saw growth when Tk_MeasureChars creates a handler for each measurement (entry-5.20 with --enable-xft --disable-bidi). Free a handler at once if no request was made while it was active, and use the serial after the round trip in the cleanup. closed check-in: a4481688 user: serhiy.storchaka tags: error-handler-free-early
17:15 • Ticket [5f7ba8c5] Leakage in trunk, with --disable-xft build status still Open with 3 other changes artifact: 4e9cfa9f user: jan.nijtmans
17:14
Fix [5f7ba8c5a3]: Restore the fix for [4a25f316f7] check-in: 54ffe89f user: jan.nijtmans tags: trunk, main
17:08 • Ticket [5f7ba8c5] Leakage in trunk, with --disable-xft build status still Open with 3 other changes artifact: 583bbf89 user: jan.nijtmans
15:56 • Ticket [4a25f316] Embedded application exits with BadDrawable when its container is destroyed status still Pending with 3 other changes artifact: 052730a4 user: serhiy.storchaka
15:55 • Ticket [5f7ba8c5] Leakage in trunk, with --disable-xft build status still Open with 3 other changes artifact: e3e48435 user: serhiy.storchaka
15:17
Fix [5f7ba8c5a3]: Restore the fix for [4a25f316f7], which was backed out because the table of deleted windows grew in loops which created and destroyed windows without a round trip to the server (entry-5.20 and place-14.1 failed with --enable-symbols=all). Only an embedded application can have its windows destroyed by someone else, so record deleted windows only if a toplevel of the application has been embedded on that display. closed check-in: 8bb13f5c user: serhiy.storchaka tags: embed-container-destroyed
14:40
Temporary backout [dd18288b] due to [5f7ba8c5a38b13d6]. Can be put back when the leakage is fixed check-in: a5c8d8db user: jan.nijtmans tags: core-8-6-branch
14:38
Temporary backout [dd18288b] due to [5f7ba8c5a38b13d6]. Can be put back when the leakage is fixed check-in: 9be64113 user: jan.nijtmans tags: core-9-0-branch
14:03
Temporary backout [dd18288b] due to [5f7ba8c5a38b13d6]. Can be put back when the leakage is fixed check-in: 37a1d23b user: jan.nijtmans tags: trunk, main
13:58 • Pending ticket [4a25f316]: Embedded application exits with BadDrawable when its container is destroyed plus 4 other changes artifact: bb949463 user: jan.nijtmans
13:56 • Ticket [5f7ba8c5] Leakage in trunk, with --disable-xft build status still Open with 3 other changes artifact: e4080754 user: jan.nijtmans
13:48 • Ticket [5f7ba8c5]: 3 changes artifact: f7f3a0ae user: jan.nijtmans
13:47 • New ticket [5f7ba8c5]. artifact: aa766616 user: jan.nijtmans

Ticket UUID: 5f7ba8c5a38b13d6a143908dd7c0caca094b5e58
Title: Leakage in trunk, with --disable-xft build
Type: Bug Version: 9.1
Submitter: jan.nijtmans Created on: 2026-10-09 13:47:56
Subsystem: (unused) Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-18 13:47:27
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-18 13:47:27
Description:

Building trunk with "configure --enable-symbols=all --disable-xft" two new failures can be seen, in "entry" and in "place":

entry.test
==== entry-5.20 -locale: the normalized value is not leaked FAILED
==== Contents of test case:
    list [growth {.e configure -locale ab_CD}] [growth {entry .w; destroy .w}]
---- Result was:
0 40
---- Result should have been (exact matching):
0 0
==== entry-5.20 FAILED
...
place.test
==== place-14.1 memory leak testing FAILED
==== Contents of test case:

# Test all manners of forgetting content frame .f frame .f.f stress { place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}] place forget .f.f } { place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}] pack .f.f update; # Needed because of TIP #518, handle <<NoManagedChild>> event. } { place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}] destroy .f frame .f frame .f.f }

---- Result was: 0 0 80 ---- Result should have been (exact matching): 0 0 0 ==== place-14.1 FAILED

The same failures also arise on MacOS with XQuarz, but the fact that it can be reproduced on Ubuntu shows that it's not an XQuarz problem.

I'll try to do a bisect

User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-18 13:47:27:

Merged by Jan into main and core-9-0-branch by commits [372a3d9e] and [6d2a074b]. Backported to core-8-6-branch by commit [7f1d1aff]. Closing the ticket.


serhiy.storchaka added on 2026-10-11 12:02:09:

The follow-up [74f808aa59] is still needed: without it deleted X error handlers were freed late, and entry-5.20 failed on Linux with Xft.

entry-5.20 and place-14.1 still fail in the macOS X11 memory job for another reason. embed.test, which runs earlier in the same process, embeds a window, and after that every destroyed window was kept in deletedWinTable until the server had processed the requests made before its deletion. The memory tests do not process events, so these entries piled up. Only the windows of an embedded toplevel can be destroyed by the container, so only they need to be recorded: proposed fix in branch deleted-windows-embedded-only, test unixEmbed-12.1. Please do not back out the fixes.


serhiy.storchaka added on 2026-10-09 18:11:49:

entry-5.20 with --enable-xft --disable-bidi: also not a real leak. Tk_MeasureChars in tkUnixRFont.c creates and deletes an X error handler for each measurement, and deleted handlers were freed only at every 10th deletion, and then only those processed before the previous round trip with the server. Proposed fix in branch error-handler-free-early: a handler during which no request was made is freed at once, and the cleanup uses the serial after the round trip. entry-5.20 and place-14.1 now pass in this configuration too.


jan.nijtmans added on 2026-10-09 17:15:49:

I tested it with --enable-symbols=all and --disable-xft. The previously failing testcases now pass. Nice solution!

Merged to trunk now. I'll do the backport later.


jan.nijtmans added on 2026-10-09 17:08:40:

> This is not a real leak

Thank you! Makes sense. I'm just trying to get 9.0 and 9.1 without any test-failures on all possible configuration variations. Better be careful ...


serhiy.storchaka added on 2026-10-09 15:55:29:

This is not a real leak: the table of recently deleted windows, added by the fix for [4a25f316f7], got an entry for every deleted window, and the entries were removed only when another window was deleted after the server had processed the requests made before the deletion. In a loop which creates and destroys windows without a round trip to the server, as in entry-5.20 and place-14.1, the entries are kept until the end, so the memory tests see the growth.

Recording the windows of other applications than embedded ones was unnecessary: only an embedded application can have its windows destroyed by someone else (the container). Now the windows are recorded only after a toplevel of the application has been embedded. Proposed fix in branch embed-container-destroyed, which restores the backed out fix with this change on top of main. entry-5.20 and place-14.1 pass with --enable-symbols=all, with and without Xft.

The fix for [f1fe739a4f] (branch embed-container-destroyed-pixmap) uses a similar table for pixmaps created for windows which no longer exist. It did not make the memory tests fail, but it now has the same restriction, since it is also only needed in embedded applications.

entry-5.20 also fails with --enable-xft --disable-bidi (tkUnixRFont.c), 64 bytes for each -locale change and each created entry, also without the fix for [4a25f316f7].


jan.nijtmans added on 2026-10-09 13:56:34:

The bisect points to [dd18288b38855f19|this] commit