Memory Leak? Considering Tcl/Tk Instead...

Stephen D. Cohen scohen at xybion.com
Fri Jun 29 16:35:45 EDT 2001


Gang,

     I hope someone can help, as I am at a loss.  I have a Python
program that is the front end for a realtime system.  The realtime
code sends data to the front panel in the form of Python statements
which are executed in a handler by use of the eval statement.  The
handler looks like this:

def fifoHandler ():
     fifo = open("/dev/rtf42");
     instr = fifo.readling()
     while 1 != 2:
          instr = fifo.readling()
          eval(instr)

     The handler is installed with code that looks like this:

root = Tk()
hist_data = {}
hist_data['avg_delay'] = StringVar()

     Then hist_data['avg_delay'] is used as a textvariable for a Tk
Label item.  The realtime code then sends commands up the fifo to set
the value of hist_data['avg_delay'].  Specifically, an example command
might look like:

hist_data['avg_delay'].set('11264')

     The problem that I am having is that the python process seems to
grow in size continuously until the machine runs out of resources.  I
am at a loss to explain what of the above should cause a continous
growth in memory usage.  Is this a well known memory leak in either Tk
or the eval function?  Does anybody have any suggestions?

     I am a long time Tcl/Tk user considering using Python for a new
project.  I would love to have access to Python's object oriented
features and vast library, but if this is the sort of quality I can
expect, I'll stick with Tcl - thank you very much.

Regards,

Steve



More information about the Python-list mailing list