Forum: Ruby-Gnome 2 Toggle references

Posted by Neil Roberts (Guest)
on 2010-06-08 13:52
(Received via mailing list)
Hi,

I filed a bug report with two patches for using toggle references for
the GObject memory management in ruby-gnome2. I just thought I'd send a
note to this list as well in case the Bugzilla isn't often checked.

https://sourceforge.net/tracker/?func=detail&aid=3012947&group_id=53614&atid=470969

Has this been discussed anywhere before? It seems like it would be more
robust than having to walk the entire hierarchy of objects in the mark
phase. As far as I can see Ruby is unique in using this method to bind
GObjects. pygtk, gjs, seed, Gtk# and java-gnome all use toggle
references.

Regards,
- Neil
Posted by Kouhei Sutou (Guest)
on 2010-06-08 14:31
(Received via mailing list)
Hi,

In <878w6prcwy.fsf@neilpc.example.org>
  "[ruby-gnome2-devel-en] Toggle references" on Tue, 08 Jun 2010 
12:17:49 +0100,
  Neil Roberts <neil@linux.intel.com> wrote:

> references.
If the method is a better method rather than the current
method, we will use the method. Did you confirm that your
patches don't cause new SEGVs and/or memory leaks? If you
already confirmed it, please show the detail. If you need
more time to confirm it, you can do it in the official
repository.


Thanks,
--
kou
Posted by Neil Roberts (Guest)
on 2010-06-08 15:08
(Received via mailing list)
Neil Roberts <neil@linux.intel.com> wrote:

> > I filed a bug report with two patches for using toggle references...

Kouhei Sutou <kou@cozmixng.org> wrote:

> If the method is a better method rather than the current method, we
> will use the method. Did you confirm that your patches don't cause new
> SEGVs and/or memory leaks? If you already confirmed it, please show
> the detail. If you need more time to confirm it, you can do it in the
> official repository.

I did some minor testing to confirm that it doesn't memory leak by
creating a simple script and stepping through it with GDB to check that
the ref counts are correct and that the mark phase is executed. I also
ran it with gtk-demo and it didn't seem to cause any problems. Of course
it's quite a tricky thing to be sure about so I may have missed
something. Are there any standard tests with ruby-gnome2 to stress the
ref counting?

I will try to make a more formal test with a write-up when I get the
chance.

Thanks
- Neil
Posted by Kouhei Sutou (Guest)
on 2010-06-09 16:30
(Received via mailing list)
Hi,

In <8739wxr7t4.fsf@neilpc.example.org>
  "Re: [ruby-gnome2-devel-en] Toggle references" on Tue, 08 Jun 2010 
14:08:07 +0100,
  Neil Roberts <neil@linux.intel.com> wrote:

> it's quite a tricky thing to be sure about so I may have missed
> something. Are there any standard tests with ruby-gnome2 to stress the
> ref counting?
> 
> I will try to make a more formal test with a write-up when I get the
> chance.

There are no standard tests to stress the ref counting but I
use the following test:

  1. select an application (e.g. demo.rb. See also
     http://ruby-gnome2.sourceforge.jp/hiki.cgi?Applications
     I'm using Rabbit for it.)
  2. create stress.rb that has the following content:
       Thread.new do
         loop do
           GC.start
           sleep 1
         end
       end
  3. run an application with the following command:
       % ruby -I. -r stress application.rb

The above test will stress to application.rb. You may find
some bugs with a standard application usage on the stress
environment.


Thanks,
--
kou
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.