GNOME Bugzilla – Bug 623543
Memory leak when using GLib.Value with GLib.Object classes
Last modified: 2017-03-25 14:49:39 UTC
Following Code causes memory leak. In first case when value is not-temporary object Foo is managed correctly, however, when a value object is created on the fly the reference counter is increased once more. So expected output should be: Ctor Dtor ---- Ctor Dtor But getting only Ctor Dtor ---- Ctor Code: class Foo : Object { public Foo() { stdout.printf("Ctor\n"); } ~Foo() { stdout.printf("Dtor\n"); } } void foo(Value v) { } static int main (string[] args) { /// Ok { Foo f=new Foo(); Value v=f; foo(v); } stdout.printf("--------\n"); /// Error { Foo f=new Foo(); foo(f); } return 0; }
Any comments? Is it a bug at all?
*** Bug 626551 has been marked as a duplicate of this bug. ***
commit 885588582e4c8423fcfaabf9f5315e457f6b9d14 Author: Jürg Billeter <j@bitron.ch> Date: Thu Sep 9 19:53:54 2010 +0200 codegen: Fix GValue memory leak after boxing Fixes bug 623543.
*** Bug 624494 has been marked as a duplicate of this bug. ***