in reply to Re: Need Help Identifying Possible Tk Memory Leak
in thread Need Help Identifying Possible Tk Memory Reuse Problem

Explicitly calling destroy does help. I did that shortly after posting and it made a dramatic difference in the memory allocated each time the window was redrawn.


Grygonos
  • Comment on Re^2: Need Help Identifying Possible Tk Memory Leak

Replies are listed 'Best First'.
Re^3: Need Help Identifying Possible Tk Memory Leak
by graff (Chancellor) on Jul 13, 2004 at 04:32 UTC
    Apropos of creating and deleting Tk windows, I wonder about the main program that calls your "guiStart" sub. Does this sub get called numerous times during the execution of the main script? Or is it rather the case that the main script does some stuff, calls this sub, does a few other things after the gui shuts down, then exits?

    If this gui comes up numerous times (for that matter, if the dialog box comes up numerous times), you might consider restructuring the app so that the windows/widgets are all created just once, then made to appear, disappear and reappear as needed, without destroying and recreating them.

    Creating and destroying widgets involves a lot of extra work; it might not be a problem now, but if you have a larger app with more widgets or more data being displayed in widgets, it can slow things down noticeably. Meanwhile, reconfiguring widgets to be visible or not visible, or changing the data that they display, is relatively fast.

      That sounds like a good idea. I would need to figure out how to create them and then pass them around. Thanks for the advice.