# Object allocation during garbage collection phase

**URL:** <https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083>\
**Category:** wxRuby\
**Created:** [August 5, 2008, 8:38pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083 "2008-08-05T20:38:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 5, 2008, 8:38pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/1 "2008-08-05T20:38:40Z")

</div>

Hello,

when i run the bigdemo sample, the app crashes initially after opening  
the “tip of the day” (it doesn’t when i don’t touch mouse and keyboard).  
can’t even get to the main window. i ran it in gdb, it gives me the  
following trace:

Starting program: /usr/local/bin/ruby bigdemo.rb  
[Thread debugging using libthread\_db enabled]  
[New Thread 0xb7c3ab60 (LWP 7428)]  
bigdemo.rb:591: [BUG] object allocation during garbage collection phase  
ruby 1.8.7 (2008-08-02 revision 0) [i686-linux]

Program received signal SIGABRT, Aborted.  
[Switching to Thread 0xb7c3ab60 (LWP 7428)]  
0xb7ef2410 in \_\_kernel\_vsyscall ()  
(gdb) whe  
#0 0xb7ef2410 in \_\_kernel\_vsyscall ()  
#1 0xb7c66085 in raise () from /lib/tls/i686/cmov/libc.so.6  
#2 0xb7c67a01 in abort () from /lib/tls/i686/cmov/libc.so.6  
#3 0xb7e3a1e2 in rb\_bug (  
fmt=0xb7ec62e8 “object allocation during garbage collection phase”)  
at error.c:213  
#4 0xb7e5dbf5 in rb\_newobj () at gc.c:444  
#5 0xb7e2b197 in bignew\_1 (klass=0, len=6, sign=7428) at bignum.c:63  
#6 0xb7e2bac9 in rb\_uint2big (n=1074221808) at bignum.c:178  
#7 0xb7e2bb51 in rb\_int2big (n=0) at bignum.c:202  
#8 0xb7e2bb98 in rb\_int2inum (n=0) at bignum.c:222  
#9 0xb7134c7e in ?? ()  
from  
/usr/local/lib/ruby/gems/1.8/gems/wxruby-1.9.7-x86-linux/lib/wxruby2.so  
#10 0xb7134c8e in ?? ()  
from  
/usr/local/lib/ruby/gems/1.8/gems/wxruby-1.9.7-x86-linux/lib/wxruby2.so  
#11 0xb7e5d6aa in garbage\_collect () at gc.c:1275  
#12 0xb7e5dbe5 in rb\_newobj () at gc.c:446  
#13 0xb7e2b197 in bignew\_1 (klass=0, len=6, sign=7428) at bignum.c:63  
#14 0xb7e2bac9 in rb\_uint2big (n=1074225608) at bignum.c:178  
#15 0xb7e2bb51 in rb\_int2big (n=0) at bignum.c:202  
#16 0xb7e2bb98 in rb\_int2inum (n=0) at bignum.c:222  
#17 0xb73de8ce in ?? ()

$ ruby -v  
ruby 1.8.7 (2008-08-02 revision 0) [i686-linux]

don’t know if this is a bug, maybe its my own fault. i don’t really need  
the bigdemo so it’s no problem for me, but maybe the wxruby devs are  
interested.

i remember that it was working when i compiled ruby (same version)  
without pthread support, maybe this is the prob (ruby 1.8.6 worked even  
with pthread support). if you need further info, please tell me.

Greetings,  
Niklas

---

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 5, 2008, 8:51pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/2 "2008-08-05T20:51:34Z")

</div>

Hi Niklas

Niklas B. wrote:

> Program received signal SIGABRT, Aborted.  
> [Switching to Thread 0xb7c3ab60 (LWP 7428)]  
> 0xb7ef2410 in \_\_kernel\_vsyscall ()  
> (gdb) whe  
> #0 0xb7ef2410 in \_\_kernel\_vsyscall ()  
> #1 0xb7c66085 in raise () from /lib/tls/i686/cmov/libc.so.6  
> #2 0xb7c67a01 in abort () from /lib/tls/i686/cmov/libc.so.6  
> #3 0xb7e3a1e2 in rb\_bug (  
> fmt=0xb7ec62e8 “object allocation during garbage collection phase”)  
> at error.c:213  
> …

Firstly, thank you for taking the time to report this in detail with a  
backtrace. It’s much appreciated.

> $ ruby -v  
> ruby 1.8.7 (2008-08-02 revision 0) [i686-linux]
> 
> don’t know if this is a bug, maybe its my own fault. i don’t really need the bigdemo so it’s no problem for me, but maybe the wxruby devs are interested.

No, it’s not your fault, and it’s not our fault either. With 1.8.7, the  
ruby developers chose to change both the public APIs and aspects of the  
GC/memory management internals. This broke any SWIG-generated ruby  
libraries that use certain SWIG features (object tracking). IMO this was  
a sloppy decision on a stable branch that reflects badly on ruby’s  
development process, but - there we are.

Anyway, I recently committed a set of patches that I think fixed this  
problem for Ruby 1.9, which has the same problem. If you’re willing to  
test this out from wxRuby’s SVN with ruby 1.8.7 that would be very kind.

cheers  
alex

---

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 5, 2008, 9:43pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/3 "2008-08-05T21:43:43Z")

</div>

Hello,

Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Anyway, I recently committed a set of patches that I think fixed this  
> problem for Ruby 1.9, which has the same problem. If you’re willing to  
> test this out from wxRuby’s SVN with ruby 1.8.7 that would be very kind.

i did what you told me, compiled wxruby from svn, but it doesn’t seem to  
work:

irb(main):001:0\> require ‘wx’  
LoadError: /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so:  
undefined symbol: \_ZNK11wxMediaCtrl12GetClassInfoEv -  
/usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so  
from /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so  
from /usr/local/lib/ruby/site\_ruby/1.8/wx.rb:12  
from (irb):1:in `require’  
from (irb):1

i have no idea of what’s going wrong here, i’m not this experienced with  
the internals of your code and with ruby development at all.

Greetings,  
Niklas

---

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 5, 2008, 10:27pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/4 "2008-08-05T22:27:22Z")

</div>

Niklas B. wrote:

> irb(main):001:0\> require ‘wx’  
> LoadError: /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so: undefined symbol: \_ZNK11wxMediaCtrl12GetClassInfoEv - /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so  
> from /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so  
> from /usr/local/lib/ruby/site\_ruby/1.8/wx.rb:12  
> from (irb):1:in `require’  
> from (irb):1
> 
> i have no idea of what’s going wrong here, i’m not this experienced with the internals of your code and with ruby development at all.

Thanks for trying it. You should be able to work around this error by  
doing

rake WXRUBY\_EXCLUDED=MediaCtrl,MediaEvent

Can I ask what wxWidgets you’re compiling against - eg a distro version,  
or a self-built one?

thanks  
alex

---

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 6, 2008, 4:16pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/5 "2008-08-06T16:16:56Z")

</div>

Hello,

Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks for trying it. You should be able to work around this error by doing
> 
> rake WXRUBY\_EXCLUDED=MediaCtrl,MediaEvent

this leaves me with exactly the same error:

niklas@niklaspc:~/ruby-cvs/wxruby/svn/trunk/wxruby2$ rake  
WXRUBY\_EXCLUDED=MediaCtrl,MediaEvent  
(in /home/niklas/ruby-cvs/wxruby/svn/trunk/wxruby2)  
Enabling DYNAMIC build  
Enabling RELEASE build  
Enabling UNICODE build  
The following wxWidgets features are not available and will be skipped:  
MediaCtrl  
MediaEvent  
PrinterDC  
niklas@niklaspc:~/ruby-cvs/wxruby/svn/trunk/wxruby2$ cd /  
niklas@niklaspc:/$ irb  
irb(main):001:0\> require ‘wx’  
LoadError: /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so:  
undefined symbol: \_ZNK11wxMediaCtrl12GetClassInfoEv -  
/usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so  
from /usr/local/lib/ruby/site\_ruby/1.8/i686-linux/wxruby2.so  
from /usr/local/lib/ruby/site\_ruby/1.8/wx.rb:12  
from (irb):1:in `require’  
from (irb):1  
irb(main):002:0\> quit

> Can I ask what wxWidgets you’re compiling against - eg a distro version,  
> or a self-built one?

$ wx-config --version-full  
2.8.7.1

it’s a distro version (libwxbase2.8-dev on ubuntu). compiling wxruby  
took long enough for me (about 30 minutes), so i didn’t try and compile  
wxwidgets.

Greetings,  
Niklas

---

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 6, 2008, 5:02pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/6 "2008-08-06T17:02:04Z")

</div>

Niklas B. wrote:

> > Can I ask what wxWidgets you’re compiling against - eg a distro version,  
> > or a self-built one?
> 
> $ wx-config --version-full  
> 2.8.7.1
> 
> it’s a distro version (libwxbase2.8-dev on ubuntu). compiling wxruby took long enough for me (about 30 minutes), so i didn’t try and compile wxwidgets.

Fair enough. I haven’t tried using the distro packages on Linux myself,  
but you might check that you also have libwxgtk-2.8 and libwxgtk2.8-dev

libwxbase contains only the non GUI classes. Only libwxgtk has  
libgstreamer as a dependency, and that’s where the MediaCtrl code is  
found.

Sorry for the inconvenience but wxwidgets has hundreds of compile-time  
options and different ways to organise the library files. It’s quite  
tricky to cope with all the variations.

alex

---

<div class="post-metadata">

**Author:** ![requiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@requiem](https://www.ruby-forum.com/u/requiem)\
**Post date:** [August 6, 2008, 8:32pm UTC](https://www.ruby-forum.com/t/object-allocation-during-garbage-collection-phase/145083/7 "2008-08-06T20:32:24Z")

</div>

Hello,

finally solved the problem as described here:  
[http://rubyforge.org/pipermail/wxruby-development/2008-May/001322.html](http://rubyforge.org/pipermail/wxruby-development/2008-May/001322.html)

could have sworn that i didn’t get this result when i asked google about  
the problem yesterday, but today i do 🙂 maybe this should be fixed…

back to topic: it does now work, bug is gone.

Greetings,  
Niklas
