Quick and Easy PC Repair
Recently, some of our readers have told us that they have encountered a tkinter bind memory leak.
I dynamically have a meaningful table with a fixed row selection (like a FIFO queue) that is constantly being updated using the tkinter
after () function. Inside the table there is a button, text that can be edited.
To make the button text editable, I used BrenBarn’s current solution and bound the current loop variable in the functional email to the
While going through the
update_content_items () process, I noticed that the memory usage in MB is increasing by MB per second. I can also confirm that after commenting out this lambda expression, the memory leak disappeared. (as seen from the terminal live, like “above”)
Looks like I am using a lambda, otherwise I would say the button has the wrong directory and the user is editing the wrong line when I just used
self.list_items [i] even if the user just clicked. Yes
is there a way to solve the problem? How can a user right click and change it, having the correct directory and getting rid of a particular leak?
def update_content_items (self): "" " Constantly fills and updates the table with rows and content. The patio table row size is initially determined by the physical value in config.ini. : return: nothing "" " in case len (self.list_items)> self. Tail axles: self.queueMaxlen is len (self.list_items) self.build_table () Try: for range i (len (self in.list_items)): item matches self.list_items [i] self.barcodeImgList [i] .image = item.plateimage orig_image = Image.open (io.BytesIO (item.plateimage)) a_image corresponds to ImageTk.PhotoImage (orig_image) The same .barcodeImgList [i] .configure (image = ein_image) the number keeps the reference because tkinter forgets it anyway ... ??? A bug in a large implementation ??? self.barcodeImgList [i] .image = some_image orig_image = No a_image means no #FIXME memory leak? self.numberList [i] .configure (text = item.number, command = lambda Self k = i: .edit_barcode (self.list_items [K])) The same .timestampList [i] .configure (text = item.timestamp) self.search_hitlist [i] .config (bg = 'blank', cursor = "xterm") self.search_hitlist [i] .unbind ("
") although item.queryresult is not None: obviously if item.queryresult.Gesamtstatus! = 'Gruen': self.search_hitlist [i] .insert (tk.END, item.queryresult.barcode +' n' + item.queryresult.permitlevel) self.search_hitlist [i] .configure (bg = 'red', cursor = "hand2") Ditto .search_hitlist [i] .bind (" ", item.url_callback) another: self.search_hitlist [i] .configure (bg = 'green', cursor = "xterm") self.search_hitlist [i] .configure (state = tk.DISABLED) self.on_frame_configure (none) self.canvas.after (10, self.update_content_items) IndexError, except such as: for number, item in list (self.list_items): seal (number, thing) increasedef edit_barcode (self, item = None): "" " Opens the digital part edit dialog and updates the same list item. : param element: like Hit DAO : return: nothing "" " If items is not None: new_item_number is equal to EditBarcodeEntry (self.master.master, article) if new_item_number.mynumber! means 0: item.number = new_item_number.mynumber self.list_items.request_work (item, 'update') self.list_items.edit_hitem_by_id (item) self.parent.master.queryQueue.put (element) another: print ("You shouldn't be doing this here. Please get the edit_barcode function.")
EDIT: There seems to be a deeper memory leak (Python itself) for sure. Images are not produced with garbage. Is memory slow in Python 3.x and am I using PIL? Again: loading is picturedit is usually not fixed by issuing a name memory leak
What can I do because I need to iterate over the numbers with records and update the labels on the images? Is there a job? PhotoImage does not have an explicit close () function, and even if I call del, the link is created by the GC and no configuration with the label is possible.
Enjoy a faster
Tkinter Bind Speicherleck
Perdida De Memoria De Enlace De Tkinter
Tkinter Bind Geheugenlek
Utechka Pamyati Tkinter Bind
Tkinter 바인드 메모리 누수
Wyciek Pamieci Powiazania Tkinter
Perdita Di Memoria Di Associazione Tkinter
Tkinter Bind Minneslacka
Fuite De Memoire Tkinter Bind
Vazamento De Memoria Tkinter Bind