memory leaks in Tkinter

David LeBlanc whisper at oz.net
Tue Nov 26 16:31:51 EST 2002


> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Jeff Epler
> Sent: Tuesday, November 26, 2002 10:04
> To: Maric MICHAUD
> Cc: Python-List (E-mail)
> Subject: Re: memory leaks in Tkinter
>
>
> I think the term "memory leak" is usually used when something can make
> the process use an unbounded amount of memory over multiple iterations.
> Here, the amount of memory consumed doesn't continue to grow over
> multiple iterations of
>     while 1:
>         x.delete(1.0, end)
>         x.insert(end, s)
>         ps()
>
> While the roughly-equivalent tcl script doesn't have quite the same memory
> usage, you'll notice that no storage is freed after '.t delete 1.0 end'.
> I suspect that this means some internal structure of the text widget
> never shrinks when its contents shrink.  Add to that the need to keep a
> copy of the Python string converted to TCL, and the memory usage may be
> "explained" as a combination of a Tkinter limitation and a Tk
> limitation.
>
> Jeff
<snip>

I know of one tkinter application that uses a lot of text widgets and leaks
hugely per Jeff Eppler's definition. I haven't figured out what the leak is,
but it's _quite_ noticable and I wish it wasn't there since I like the app a
lot. The app is Leo ( http://sourceforge.net/projects/leo/).

David LeBlanc
Seattle, WA USA





More information about the Python-list mailing list