[Kde-bindings] Ruby 1.9.x GC.stress + qtruby ([BUG] object allocation during garbage collection phase)

Davor Ocelic docelic at spinlocksolutions.com
Thu Mar 12 17:15:51 UTC 2009


Hello folks,

We have noticed an issue with qtruby and Ruby 1.9.x when
GC.stress= true.

When the GC is marking objects, and it encounters any kind of
Qt layout, it uses itemAt() to dive in and access individual
contained widgets.

It calls respond_to() to see whether itemAt() is redefined
in Ruby; if not (which is most of the time), before the first
call to Qt's itemAt(), it tries to intern the method name,
which in Ruby 1.9.x creates a new string, but object creation
is not allowed during garbage collection phase.

So the program fails with an error
 "[BUG] object allocation during garbage collection phase"


The quick solution to the problem is interning the symbols
manually, before layouts are used. For example, just
saying:

  ...
  'itemAt'.intern
  ...
  l= Qt::HBoxLayout.new...


I think this may be affecting all types of Qt objects
that can contain other widgets (not just layouts).
(Just of course it would not be itemAt() but some other
function.)

Would the right solution be to add support for this
directly in qtruby and intern the needed method names
there automatically, before they are used by GC?

Cya,
-doc



More information about the Kde-bindings mailing list