# Problem with garbaje collection phase

**URL:** <https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531>\
**Category:** Ruby-Gnome 2\
**Created:** [October 22, 2008, 3:13pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531 "2008-10-22T15:13:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [October 22, 2008, 3:13pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/1 "2008-10-22T15:13:31Z")

</div>

Hello,

I’m having problems with the execution of various programs with ruby  
ruby 1.8.7 (2008-08-11 patchlevel 72), and ruby-gnome2 0.17.0~rc1-6.  
When  
I run the programs, always stop and arise and message like:

./unidades.rb:210: [BUG] object allocation during garbage collection  
phase  
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86\_64-linux]

Abortado

This programs are very important for me, because I had worked on them  
during the past years and I use them for my work. They are very large  
programs, and  
I can’t put here to reproduce this problem.

My question is: Is a ruby problem o a ruby-gnome2 problem? Is there any  
fix in progress?. Is there anyone with the same problem?

The only way in that I can work with my programs from now is working  
with libruby1.8 (1.8.6.114-2)

Thanks  
Antonio Ignacio Cabrera Santana

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [October 22, 2008, 3:26pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/2 "2008-10-22T15:26:30Z")

</div>

On Wed, Oct 22, 2008 at 1:13 PM, Antonio Ignacio Cabrera Santana  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,
> 
> I’m having problems with the execution of various programs with ruby ruby  
> 1.8.7 (2008-08-11 patchlevel 72), and ruby-gnome2 0.17.0~rc1-6. When  
> I run the programs, always stop and arise and message like:
> 
> ./unidades.rb:210: [BUG] object allocation during garbage collection phase  
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86\_64-linux]

This happens typically when using ruby \>= 1.8.7 with ruby-gtk2 \<  
0.17.0. You have to either downgrade ruby or upgrade ruby-gtk2.

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 26, 2009, 2:24pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/3 "2009-01-26T14:24:45Z")

</div>

hi,

i have this issue now with the followind combination:  
dev-lang/ruby-1.8.6\_p287-r11  
dev-ruby/rcairo-1.8.0  
dev-ruby/ruby-atk-0.18.1-r1  
dev-ruby/ruby-gdkpixbuf2-0.18.1-r1  
dev-ruby/ruby-glib2-0.18.1-r1  
dev-ruby/ruby-gtk2-0.18.1-r1  
dev-ruby/ruby-gtksourceview-0.18.1  
dev-ruby/ruby-pango-0.18.1-r1  
dev-ruby/ruby-prof-0.7.2  
dev-ruby/rubygems-1.3.1

i thought it was fixed in 0.17.0 (according to  
[Rg2 misbehaving with ruby 1.8.7? - Ruby-Gnome 2 - Ruby-Forum](http://www.ruby-forum.com/topic/157194))

any news on that?

thanks in advice  
balint

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 26, 2009, 6:48pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/4 "2009-01-26T18:48:50Z")

</div>

i can get rid of this error only, if i downgrade to ruby-1.8.6\_p114.  
both on x86 and amd64.

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 27, 2009, 10:25pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/5 "2009-01-27T22:25:48Z")

</div>

hi,

i was attempting to write a small script to catch the bug, but very soon  
ended up with the attached one resulting this:

$ ruby gc\_bug\_attempt.rb  
Xlib: extension “RANDR” missing on display “:0.0”.  
“1.8.6”  
[2, 14, 7]  
[0, 18, 1]  
Segmentation fault

clicking the button segfaults.  
this is not the garbage allocation bug.

can you reproduce this?

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 27, 2009, 2:29pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/6 "2009-01-27T14:29:47Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] problem with garbaje collection phase” on  
Mon, 26 Jan 2009 19:48:25 +0200,  
Dobai-Pataky Bálint [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i can get rid of this error only, if i downgrade to ruby-1.8.6\_p114. both on  
> x86 and amd64.

Could you show us your test script? I’ll test it on my  
environment.

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 28, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/7 "2009-01-28T16:43:21Z")

</div>

Kouhei S. wrote:

> > $ ruby gc\_bug\_attempt.rb
> 
> % svn co [https://ruby-gnome2.svn.sourceforge.net/svnroot/ruby-gnome2/ruby-gnome2/trunk](https://ruby-gnome2.svn.sourceforge.net/svnroot/ruby-gnome2/ruby-gnome2/trunk) ruby-gnome2  
> % cd ruby-gnome2  
> % ruby extconf.rb  
> % make \> /dev/null  
> % ruby `for x in /tmp/ruby-gnome2/*; do echo -n "-I$x/lib -I$x -I$x/src/lib -I$x/src "; done ` /tmp/gc\_bug\_attempt.rb
> 
> ## Thanks,
> 
> kou

the Segmentation fault generated by the gc\_bug\_attempt.rb is gone, but  
the  
[BUG] object allocation during garbage collection phase  
ruby 1.8.6 (2008-08-11) [i686-linux]

/usr/lib/ruby/1.8/drb/drb.rb:585: [BUG] Segmentation fault  
ruby 1.8.6 (2008-08-11) [i686-linux]

is there in trunk, so i’ll try to simulate it in gc\_bug\_attempt.rb.

thanks Kou

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 28, 2009, 1:34pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/8 "2009-01-28T13:34:39Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] problem with garbaje collection phase” on  
Tue, 27 Jan 2009 23:25:05 +0200,  
Dobai-Pataky Bálint [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> clicking the button segfaults.  
> this is not the garbage allocation bug.
> 
> can you reproduce this?

Thanks for show a sample program.  
But I can’t reproduce it with:

- ruby 1.8.7 (2008-08-11 patchlevel 72) [x86\_64-linux]
- Ruby-GNOME2 trunk

If you can, could you try Ruby-GNOME2 trunk?

% cd /tmp  
% svn co

> **[Ruby-GNOME 2](https://sourceforge.net/projects/ruby-gnome2/)**
>
> Download Ruby-GNOME 2 for free. This project is a set of Ruby language bindings for the various application development libraries included with the GNOME/GTK+ environment. This project is for GTK+2.0 or later.

ruby-gnome2  
% cd ruby-gnome2  
% ruby extconf.rb  
% make \> /dev/null  
% ruby `for x in /tmp/ruby-gnome2/*; do echo -n "-I$x/lib -I$x -I$x/src/lib -I$x/src "; done ` /tmp/gc\_bug\_attempt.rb

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 29, 2009, 9:17am UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/9 "2009-01-29T09:17:57Z")

</div>

Kou, i found it, narrowed it down to the attached script.

tested it with rg2 Revision: 3589

affected ruby versions:  
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]  
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

here are my results:  
ruby `for x in /opt/ruby-gnome2/*; do echo -n "-I$x/lib -I$x -I$x/src/lib -I$x/src "; done` ruby/gc\_bug\_attempt.rb  
“ruby:1.8.6, gtk:[2, 14, 7],rg2:[0, 19, 0]”  
“start 02”  
“created: #\<Gtk::TreeView:0xb5dc76c4 ptr=0x827f050\>”  
“start 03”  
“destroying: #\<Gtk::TreeView:0xb5dc76c4 ptr=0x827f050\>”  
ruby/gc\_bug\_attempt.rb:33: [BUG] object allocation during garbage  
collection phase  
ruby 1.8.6 (2008-08-11) [i686-linux]

ruby/gc\_bug\_attempt.rb:33: [BUG] Segmentation fault  
ruby 1.8.6 (2008-08-11) [i686-linux]

unaffected ruby version: ruby 1.8.6 (2008-03-03 patchlevel 114)  
[i686-linux]  
ruby `for x in /opt/ruby-gnome2/*; do echo -n "-I$x/lib -I$x -I$x/src/lib -I$x/src "; done` ruby/gc\_bug\_attempt.rb  
Xlib: extension “RANDR” missing on display “:0.0”.  
“ruby:1.8.6, gtk:[2, 14, 7],rg2:[0, 19, 0]”  
“start 02”  
“created: #\<Gtk::TreeView:0xb5d7f720 ptr=0x845a030\>”  
“start 03”  
“destroying: #\<Gtk::TreeView:0xb5d7f720 ptr=0x845a030\>”  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
“created: #\<Gtk::TreeView:0xb5d7f6f8 ptr=0x845a200\>”  
“start 04”  
“destroying: #\<Gtk::TreeView:0xb5d7f6f8 ptr=0x845a200\>”  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
ruby/gc\_bug\_attempt.rb:20: warning: GRClosure invoking callback: already  
destroyed  
“created: #\<Gtk::TreeView:0xb5d7f6bc ptr=0x845a3d0\>”  
…

if i trigger GC myself, then it needs 2 runs, if not, it needs around 11  
runs on my athlon64/x86\_32/3G ram, gentoo  
just run it and press the button until the bug appears.

another thing, i got a question, at line 42 there is a block, is there  
wrong something with that? i’d like to use that, i want to save some  
settings done by the user on TreeViewColumn.destroy

hope it helps finding it  
thank you  
balint

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 31, 2009, 10:26am UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/10 "2009-01-31T10:26:15Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] problem with garbaje collection phase” on  
Thu, 29 Jan 2009 10:17:07 +0200,  
Dobai-Pataky Bálint [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Kou, i found it, narrowed it down to the attached script.

Thanks! I can reproduce the problem.

Detail:

1. GC
2. Gtk::Object is destroyed
3. Gtk::Object emits “destroy” signal
4. You create an object
5. “[BUG] object allocation during garbage collection”

Workaround:  
before:  
col.signal\_connect(“destroy”){|me| p “destroy: #{me.inspect}”}  
after:  
# col.signal\_connect(“destroy”){|me| p “destroy: #{me.inspect}”}

I’ll consider other solution but don’t expect quick  
fixing. I’m very busy now…

Perhaps Ruby 1.8.8 will not occur the problem because Ruby  
1.8.8 defers destroying some objects after mark&sweep phase.

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [February 9, 2009, 5:52pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/11 "2009-02-09T17:52:46Z")

</div>

Thanks for working on this guys. I didn’t know it before but I think  
I’ve been caught by this bug.

best,  
Dan

* * *

Daniel L.  
[http://www.daniellucraft.com/](http://www.daniellucraft.com/)

---

<div class="post-metadata">

**Author:** ![Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8491ac/32.png) [@Antonio\_Ignacio\_Cab](https://www.ruby-forum.com/u/Antonio_Ignacio_Cab)\
**Post date:** [January 31, 2009, 2:23pm UTC](https://www.ruby-forum.com/t/problem-with-garbaje-collection-phase/151531/12 "2009-01-31T14:23:47Z")

</div>

Kouhei S. wrote:

> Thanks! I can reproduce the problem.  
> col.signal\_connect(“destroy”){|me| p “destroy: #{me.inspect}”}  
> after:  
> # col.signal\_connect(“destroy”){|me| p “destroy: #{me.inspect}”}

i thought it’s triggered at line 16.

> I’ll consider other solution but don’t expect quick  
> fixing. I’m very busy now…

no problem, thank you for confirming it.

> Perhaps Ruby 1.8.8 will not occur the problem because Ruby  
> 1.8.8 defers destroying some objects after mark&sweep phase.

until than i stick at 1.8.6\_p114  
thanks  
balint
