Re: Tkinter plans

Guido.van.Rossum@cwi.nl
Sun, 12 Jun 1994 17:05:25 +0200

> I've tried putting some free()'s into tkintermodule.c, but it doesn't
> seem to solve the problem. The irc client I've been writing uses
> after() frequently, and gradually goes from about 2MB to 11MB+.
>
> Maybe profiling the module would help find the memory leaks.

>From looking at the source there's one big memory leak: when
converting a Python value to a Tcl value, if it encounters a
non-string, it calls strobject() on it but never frees its return
value. There's an XXX in the source, so I suppose Steen knows he
should be more sophisticated. Since the resulting string must be kept
alive until after Tcl_Merge (or whatever) has been called, I propose
to pass a list of temporary objects along, to which all such string
objects are appended. Then a DECREF on the list will release all
strings at once.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>