Memory leak on Gtk 3.0 set_text
System environment:
Windows 10 21H2 19044.1889 use msys2 mingw-w64-x86_64
- GTK: 3.24.34+87+g8bbc24c165-3
- PyGObject: 3.42.1-4
- Python: 3.10.6
- glib2: 2.72.3
- libffi:3.4.2
I need to update label every 30 ms.I tested set_text,set_label and set_markup and they all memory leak on GTK 3.0,but when open the GTK inspector they don't leak.
Try they in GTK 2.0 and GTK 4.0 and they don't leak
I can't fix this, how can i do?
Thanks
example:
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib
class mainWindow:
def __init__(self):
self.window = Gtk.Window()
self.label = Gtk.Label()
self.window.add(self.label)
self.window.connect("destroy", Gtk.main_quit)
self.window.show_all()
def updatelabel(self):
text = "Leaking memory!"
self.label.set_text(text)
return True
def timer(self):
self.timer = GLib.timeout_add(30, self.updatelabel)
if __name__ == '__main__':
mainwindow = mainWindow()
mainwindow.timer()
Gtk.main()
Edited by Mike Li