inheritance from Tkinter == leaks. true?
Verfasst: Dienstag 30. Oktober 2007, 23:27
Hello everybody
I've just started playing with Pyhon( circ. 1 month).
And need Your help.
With so nice and productive language, builded application with GUI based on Tkinter. Its almost done but... wanted to check resources usage and found huge memory leaks. Its about classes ingerted from Tkinter classes.
Eg. when i create an object from Frame:
after 'my_class.destroy()' and 'my_class=Null' the garbage collection stores 'my_class', 'button' and some dictionaries and never throw them away.
if i define it like this
after destroy() and overwriting referenced name all is cleaned up.
I've worked it around by:
and now after any number of creating/destroying that object there are no aditional garbage.
Is this version(Python2.5)/platform(fedora7,win32) issue or it's my way of using Tkinter? Or bug?
On Polish board i've no replies for that. And time is running.
Or the best way is to switch to wx or something else( to witch it will be simplest for me?)
Sorry that in En. Sorry that this En is so poor.
I've just started playing with Pyhon( circ. 1 month).
And need Your help.
With so nice and productive language, builded application with GUI based on Tkinter. Its almost done but... wanted to check resources usage and found huge memory leaks. Its about classes ingerted from Tkinter classes.
Eg. when i create an object from Frame:
Code: Alles auswählen
class my_frame( Tkinter.Frame ):
def __init__( self, master=None )
Tkinter.Frame.__init__( self, master )
self.but = Tkinter.Button( master=self )
self.but.grid()
if i define it like this
Code: Alles auswählen
class my_frame( Tkinter.Frame ):
def __init__( self, master=None )
Tkinter.Frame.__init__( self, master )
but = Tkinter.Button( master=self ) wyczyszczony
but.grid()
I've worked it around by:
Code: Alles auswählen
class my_class ():
def __init__(self, master=None):
self.frame = Frame( master )
self.but = Button( self.frame )
self.but.grid()
def grid( self, **opt ):
self.frame.grid( opt )
def destroy( self ):
self.frame.destroy()
Is this version(Python2.5)/platform(fedora7,win32) issue or it's my way of using Tkinter? Or bug?
On Polish board i've no replies for that. And time is running.
Or the best way is to switch to wx or something else( to witch it will be simplest for me?)
Sorry that in En. Sorry that this En is so poor.