From: Kouhei S. <ko...@co...> - 2015-01-11 08:44:21
|
Hi, In <CAG...@ma...> "Re: [ruby-gnome2-devel-en] ref and unref" on Thu, 8 Jan 2015 16:39:45 +0000, jc...@gm... wrote: > It doesn't seem to work for me. If I run: > > 10000.times do > Vips::Image.new > end > GC.start > > I still have 10,000 GObjects, each with one ref. Really? > My code is here: > > https://github.com/jcupitt/ruby-vips8/blob/master/try/try2.rb#L98 I run the code with the following diff: -- diff --git a/try/try2.rb b/try/try2.rb index 53c4272..0b214fa 100755 --- a/try/try2.rb +++ b/try/try2.rb @@ -97,6 +97,8 @@ end 10000.times do Vips::Image.new end +p(ObjectSpace.each_object(Vips::Image) {}) GC.start +p(ObjectSpace.each_object(Vips::Image) {}) -- I got the following: -- Vips::const_missing: Image Vips::init: [] Vips::Loader.initialize: Vips, [] Vips::Loader.pre_load: #<GObjectIntrospection::Repository:0x0000000286eaa0>, Vips Vips::Loader.call_init_function: #<GObjectIntrospection::Repository:0x0000000286eaa0>, Vips Vips::Loader.post_load: 41 0 -- Did you use the latest gobject-introspection gem? I used gobject-introspection 2.2.4 gem: -- % gem list gobject-introspection *** LOCAL GEMS *** gobject-introspection (2.2.4) -- Thanks, -- kou |