Memory leak on setting properties
The following code reveals a memory leak (at least here on my Debian stable machine). After a few minutes, memory consumption of the process is in the area of gigabytes.
import gi
import threading
import time
gi.require_version("Gtk", "3.0")
from gi.repository import GLib
from gi.repository import Gtk
def foo(label):
label.props.label = 1000000 * "x"
def bar(label):
while True:
time.sleep(1)
GLib.idle_add(foo, label)
def main():
box = Gtk.Box(visible=True)
label = Gtk.Label(visible=False)
box.add(label)
window = Gtk.Window(visible=True)
window.add(box)
threading.Thread(target=bar, args=(label,)).start()
GLib.MainLoop().run()
if __name__ == "__main__":
main()
It also happens when I realize a similar behavior without the thread.
It also happens using .set_property
instead of .props.label=...
.
It does not happen when I use .set_label
instead, though.
Edited by Josef Hahn