Gio.File.load_contents() memory leak
Related to #127 (closed) I guess.
When using Gdk.cairo_surface_create_from_pixbuf(), looks like python GC never free memory.
Using pixbuf.copy() allow GC to do some job (not sure if all is ok in this case too):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(path, 200, 200)
surface = Gdk.cairo_surface_create_from_pixbuf(
pixbuf.copy(), self.get_scale_factor(), None)
self.set_from_surface(surface)
Here two scripts showing the issue: gc_ok.py gc_bad.py
And the result is some Mio better for gc_ok.py:
More visible with lollypop:
- Without pixbuf.copy(), memory usage just grows.
- With pixbuf.copy(), memory usage is stable and sometimes is even released.
Edited by Cédric Bellegarde