I think that one thread before your question may answer your question: here!
If I change the code:
...
if (this.pixbuf) {
// this.pixbuf.destroy(); // this line is left out
this.pixbuf.unref(); // this line is new
delete this.pixbuf; // this line is new
this.pixbuf = null;
core.memory.GC.collect();
}
this.pixbuf = new Pixbuf(filename);
...
the memory leak seams more slowly, but it's still there. So still not usable for a program running 24/7. Also, I get 9 times (after every 2nd image switch):
GLib-GObject-CRITICAL **: gobjectunref: assertion 'GISOBJECT (object)' failed
With this code:
...
if (this.pixbuf) {
this.pixbuf.destroy(); // this line in again
this.pixbuf.unref(); // this line is new
delete this.pixbuf; // this line is new
this.pixbuf = null;
core.memory.GC.collect();
}
this.pixbuf = new Pixbuf(filename);
...
the program SEGVs as soon as the 'if' body is run.
As I understand D, the entire 'if' block should be unnecessary, since D manages garbage collection under the hood. In case of gtkD, the Pixbuf dtor should handle the reference count of gdkPixbuf.
Any other suggestions?
Diez