Issue 34794: Memory leak in Tkinter (original) (raw)

Created on 2018-09-24 21:30 by dtalkin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
leak_demo.py dtalkin,2018-09-25 14:24
leak_demo2.py serhiy.storchaka,2018-10-21 11:56
Pull Requests
URL Status Linked Edit
PR 9559 closed serhiy.storchaka,2018-09-25 08:07
PR 10025 merged serhiy.storchaka,2018-10-21 11:57
PR 10069 merged miss-islington,2018-10-23 19:41
PR 10070 merged miss-islington,2018-10-23 19:41
PR 10181 merged serhiy.storchaka,2018-10-28 16:50
Messages (8)
msg326289 - (view) Author: David Talkin (dtalkin) Date: 2018-09-24 21:30
The Tkinter.PhotoImage class leaks memory with each change of the 'data' Attribute due to Image calling tk._createbytearray, which allocates memory, but never frees it. The offending method is in the TkApp class, _createbytearray().
msg326327 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-09-25 06:55
Thanks for the report David. Feel free to attach reproducible script if any that might trigger this. I am adding Serhiy who might have a better understanding of this. Relevant issue where _createbytearray was added : .
msg326355 - (view) Author: David Talkin (dtalkin) Date: 2018-09-25 14:24
Attached please find a Python script that demonstrates the bug. David On Tue, Sep 25, 2018 at 2:55 AM Karthikeyan Singaravelan < report@bugs.python.org> wrote: > > Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment: > > Thanks for the report David. Feel free to attach reproducible script if > any that might trigger this. I am adding Serhiy who might have a better > understanding of this. Relevant issue where _createbytearray was added : > . > > ---------- > nosy: +serhiy.storchaka, xtreak > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue34794> > _______________________________________ >
msg328205 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-21 11:56
Here is a simpler reproducer. Actually the problem was not in _createbytearray(), but in converting the Python wrapper around Tcl_Obj into Tcl_Obj. _createbytearray() just exposed it. The leak exists in Python 3 too, but it is hard to reproduce it.
msg328338 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-23 19:40
New changeset df13df41a25765d8a39a77220691698498e758d4 by Serhiy Storchaka in branch 'master': bpo-34794: Fix a leak in Tkinter. (GH-10025) https://github.com/python/cpython/commit/df13df41a25765d8a39a77220691698498e758d4
msg328342 - (view) Author: miss-islington (miss-islington) Date: 2018-10-23 20:25
New changeset 2c549250d8fd6755e3338a771d250e34c78bdb50 by Miss Islington (bot) in branch '3.6': bpo-34794: Fix a leak in Tkinter. (GH-10025) https://github.com/python/cpython/commit/2c549250d8fd6755e3338a771d250e34c78bdb50
msg328347 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-23 21:46
New changeset f7cefb427cbc50d89a4f19f7f334a4f5421cefd3 by Victor Stinner (Miss Islington (bot)) in branch '3.7': bpo-34794: Fix a leak in Tkinter. (GH-10025) (GH-10069) https://github.com/python/cpython/commit/f7cefb427cbc50d89a4f19f7f334a4f5421cefd3
msg328715 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-28 17:36
New changeset aaea2802da0a074c695ab86911d8bcc0b2dd5ec5 by Serhiy Storchaka in branch '2.7': [2.7] bpo-34794: Fix a leak in Tkinter. (GH-10025) (GH-10181) https://github.com/python/cpython/commit/aaea2802da0a074c695ab86911d8bcc0b2dd5ec5
History
Date User Action Args
2022-04-11 14:59:06 admin set github: 78975
2018-10-28 19:14:46 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-10-28 17:36:06 serhiy.storchaka set messages: +
2018-10-28 16:50:30 serhiy.storchaka set pull_requests: + <pull%5Frequest9504>
2018-10-23 21:46:43 vstinner set nosy: + vstinnermessages: +
2018-10-23 20:25:57 miss-islington set nosy: + miss-islingtonmessages: +
2018-10-23 19:41:18 miss-islington set pull_requests: + <pull%5Frequest9403>
2018-10-23 19:41:10 miss-islington set pull_requests: + <pull%5Frequest9402>
2018-10-23 19:40:58 serhiy.storchaka set messages: +
2018-10-21 12:05:09 serhiy.storchaka set title: memory leak in TkApp:_createbytearray -> Memory leak in Tkinter
2018-10-21 11:57:08 serhiy.storchaka set pull_requests: + <pull%5Frequest9364>
2018-10-21 11:56:54 serhiy.storchaka set files: + leak_demo2.pymessages: + versions: + Python 3.6, Python 3.7, Python 3.8
2018-09-25 14:24:46 dtalkin set files: + leak_demo.pymessages: +
2018-09-25 08:07:04 serhiy.storchaka set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest8961>
2018-09-25 06:55:24 xtreak set nosy: + serhiy.storchaka, xtreakmessages: +
2018-09-24 21:30:12 dtalkin create