IDLE's PyShell

Tim Peters tim_one at email.msn.com
Wed Jul 21 00:57:34 EDT 1999


[Vladimir Marangozov]
> Just noticed that IDLE's interactive shell eats an unusually big
> amount of memory. Just pressing the RETURN key a couple of times,
> or even better ;-) -- closing and reopening the PyShell window
> does not seem to reuse the prevously allocated memory...

Christian (Tismer) ruined my life several weeks ago by noting that if he
typed

    sys.getrefcount(None)

in the IDLE shell, it kept going up & up & up as windows were opened and
closed.  That's a pretty good sign of A Leak.  The CVS version has plugged
many leaks, and I just submitted a brief patch to plug 3 more, but it's
still leaking.  At least *closing* a window no longer boosts None's
refcount!  Opening one does, though.

> I'm very far from this code, so don't blame me for not proposing a
> patch, but here are two things I experimented with that seem to help
> partially:
>
> 1. Clear the linecache when closing the PyShell window

Submit a patch!

> 2. Finalize properly the undo machinery in EditorWindow
>    (yes -- the XXX sign is there to remind that the _close
>     method needs more work regarding undo)
>    For instance, I tried to finalize undo before self.io.close
>    which seemed to work.

Not sure that one's a problem anymore; the undo machinery doesn't show up on
the list of live objects at the end for me anymore.  The Tk Text instance
still does, though, and that's a biggie.

just-stop-opening-and-closing-the-shell<wink>-ly y'rs  - tim






More information about the Python-list mailing list