|
2026-10-23
| ||
| 12:29 | • Ticket [31085d27] Unexpected behavior after creating around 10000 ttk::labels on Windows status still Closed with 4 other changes artifact: 098c3b18 user: jan.nijtmans | |
| 12:26 | • Ticket [31085d27]: 4 changes artifact: 792db8f0 user: jan.nijtmans | |
| 12:25 | • Ticket [31085d27]: 5 changes artifact: 829adc5f user: jan.nijtmans | |
| 10:16 | • Closed ticket [31085d27]. artifact: 2d294bd7 user: serhiy.storchaka | |
|
2026-10-19
| ||
| 17:24 | • Ticket [31085d27]: 3 changes artifact: d0312bb6 user: jan.nijtmans | |
| 17:03 | • Ticket [31085d27]: 4 changes artifact: eaef3e43 user: oehhar | |
|
2026-09-21
| ||
| 21:18 | • Ticket [870844ff] WinTk: many menus in menubar won't popup status still Open with 4 other changes artifact: 9ce01c83 user: serhiy.storchaka | |
|
2026-09-19
| ||
| 11:19 | • Ticket [31085d27] Unexpected behavior after creating around 10000 ttk::labels on Windows status still Open with 2 other changes artifact: 0bfc35b3 user: serhiy.storchaka | |
|
2026-09-18
| ||
| 13:30 | • Ticket [ca4aa4c9] Unstable with lots of ttk::labels in subframes in two parents status still Open with 3 other changes artifact: b11b5be7 user: serhiy.storchaka | |
| 13:30 | • Ticket [88ffa704] Above roughly 10000 widgets wish hangs on Windows status still Open with 3 other changes artifact: abb0ae2a user: serhiy.storchaka | |
| 13:30 | • Ticket [31085d27] Unexpected behavior after creating around 10000 ttk::labels on Windows status still Open with 3 other changes artifact: 094557c3 user: serhiy.storchaka | |
| 13:28 |
Fix [31085d2747]: do not create the window of a ttk widget until it is mapped
Since [97048e9881] the ttk widget constructor called Tk_MakeWindowExist(), so on Windows every ttk widget consumed a window handle even when never mapped, and 10000 of them exhausted the per-process handle quota. Classic widgets create their windows only when mapped. The layout is now updated on the first MapNotify event instead, since <<ThemeChanged>> events are not delivered to unrealized windows. The tests which generated events on never mapped widgets now map them first. check-in: 7fc6686e user: serhiy.storchaka tags: ttk-lazy-window-creation | |
|
2020-09-07
| ||
| 19:38 | • Ticket [31085d27] Unexpected behavior after creating around 10000 ttk::labels on Windows status still Open with 3 other changes artifact: 61648c0e user: fvogel | |
| 08:39 | • Ticket [31085d27]: 3 changes artifact: 3910559b user: SoleSoul | |
| 08:32 | • Ticket [31085d27]: 3 changes artifact: ad6b8867 user: SoleSoul | |
| 08:29 | • Ticket [31085d27]: 3 changes artifact: 325006d5 user: SoleSoul | |
| 08:22 | • Ticket [31085d27]: 3 changes artifact: 92abab1d user: SoleSoul | |
| 08:21 | • Ticket [31085d27]: 3 changes artifact: cdae1dfe user: SoleSoul | |
| 08:18 | • Ticket [31085d27]: 3 changes artifact: f0acf2b2 user: SoleSoul | |
| 08:16 | • Ticket [31085d27]: 3 changes artifact: af5a2918 user: SoleSoul | |
| 07:55 | • New ticket [31085d27]. artifact: a906dff4 user: SoleSoul | |
| Ticket UUID: | 31085d2747c86255545d4da96c0743bb8eb13859 | |||
| Title: | Unexpected behavior after creating around 10000 ttk::labels on Windows | |||
| Type: | Bug | Version: | 8.6.9 | |
| Submitter: | SoleSoul | Created on: | 2020-09-07 07:55:26 | |
| Subsystem: | 88. Themed Tk | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2026-10-23 12:29:42 | |
| Resolution: | Fixed | Closed By: | jan.nijtmans | |
| Closed on: | 2026-10-23 12:29:42 | |||
| Description: |
TCL/TK version: 8.6.9
OS: Windows 10
Found in tkinter (Python 3.8), but reproducible in pure TCL.
Observation:
After creating around 10000 widgets (verified with ttk::label), comboboxes won't open, and newly created widgets won't be 'grid'ed on the window. Sometimes graphical artifacts appear outside the application window.
No error message or exception is raised.
Expected:
Either the limit can be removed, or at least document and return runtime errors to prevent the weird behavior.
Why is such a large number required:
We have a data heavy application which dynamically creates widgets according to changing data, and the application is in constant risk of failing. The size of the data is determined by the customer.
How to reproduce:
Take a working application, and add to its source, before the window is built, the following code:
for {set i 0} {$i < 10000} {incr i} {
ttk::label ".l$i" -text problematic
}
The number 10000 is the limit found, feel free to play with it.
Issue opened on Python's tkinter (rightfully closed as third party): https://bugs.python.org/issue41632
Related StackOverflow question (on tkinter): https://stackoverflow.com/questions/51486281/tkinter-maximum-number-of-widgets
| |||
| User Comments: |
jan.nijtmans added on 2026-10-23 12:29:42:
Sorry, that bisect points to another ticket: [1348333] This one is OK! jan.nijtmans added on 2026-10-23 12:26:32: fossil bisect chart 1 BAD 2026-10-23 09:20:10 6d6d38074ea28fcb 7 CURRENT 2026-10-23 08:55:12 73142d715206a61b 4 BAD 2026-10-23 08:42:11 bdb7edf927982f35 5 BAD 2026-10-22 18:23:16 fb166f9f73106ab2 6 BAD 2026-10-22 17:32:35 4b3b840a41badb6a 3 GOOD 2026-10-22 15:14:16 51a8eab8eee4e121 2 GOOD 2026-10-21 15:23:43 b8fb1d6c114cce4a jan.nijtmans added on 2026-10-23 12:25:49: I'm seeing a hang in textWind-17.10. Investigating! serhiy.storchaka added on 2026-10-23 10:16:38: Merged into main [92ccdec3f2], 9.0 [3efcdcac36] and 8.6 [3d4a73e5eb]. jan.nijtmans added on 2026-10-19 17:24:47: Re-opened. Didn't know what happened oehhar added on 2026-10-19 17:03:19: Jan, you have closed the solution branch head checkin [ee0b7a51]. Do you have any reason for this? CI is still scheduled. Didn't it work out? Thanks for all, Harald serhiy.storchaka added on 2026-09-18 13:30:20: Every Tk widget uses one window handle on Windows, and a process is limited to 10000 USER handles by default (USERProcessHandleQuota in the registry, up to 18000). Nothing can be done about it for mapped widgets. But ttk widgets created their window at creation time, so 10000 widgets that were never mapped also hit the limit, while classic widgets create their window only when mapped. Fixed on branch ttk-lazy-window-creation in [7fc6686e76]: ttk widgets now behave like classic widgets, which also makes their creation on Windows about 10 times faster. Note that after this change, as for classic widgets, event generate on a ttk widget that was never mapped has no effect. When the handle quota is exhausted, Tk still continues with invalid windows instead of reporting an error; this is a separate issue. fvogel added on 2020-09-07 19:38:50: It seems that chw in the chat said it all: [11:20] chw windows 10k window handles problem: see http://stackoverflow.com/questions/951419/ddg#951450 [11:20] chw each tk widget consumes a windows handle [11:20] chw a windows window handle [11:22] chw conclusion: Windows isn't appropriate for building huge sky scrapers, silos aren't a problem, but lack Windows --> there is probably no hope about this ticket for Windows. Contributions in the chat also mentioned that Linux and macOS don't exhibit the issue. SoleSoul added on 2020-09-07 08:39:06: sebres: looks like some issue of ttk:widgets, testing the same with tk- (not ttk::-) label works fine and doesn't show the behavior: nor the "freeze" in window, neither the creating time growing (ca 50µs/# constantly) SoleSoul added on 2020-09-07 08:29:30: Another quote from IRC with details about the issue:
sebres:
it is tk (at least for windows), repeat `time {ttk::label ".l[incr i]" -text demo} 1000` 10 times slowing down tk continuously, after 10th you cannot even enter console menu anymore
this seems to have some bottleneck by creation even, 600µs/# first run, 1500µs/# 10th run; single linked list?
same result with fresh compiled current core-8-6-branch (tcl and tk)
SoleSoul added on 2020-09-07 08:16:26: Quote from IRC - confirmations of the issue: avl42: I tried it with a tclkit 8.6.10 from equi4 with twapi on windows, and 8.6.8 default wish on ubuntu 18.04 on windows, after creating those 10000 labels (non-displayed) creating and gridding further widgets only re-arranged the toplevel's geometry but didn't show anything but gray background | |||
