[BUG] rb_gc_mark(): unknown data type 0x34(0x8a69570) non object

I get the following error:

perm.rb:17: [BUG] rb_gc_mark(): unknown data type 0x34(0x8a69570) non object
ruby 1.8.1 (2004-04-24) [i686-linux-gnu]

Ruben

···

===================================================================

class GeneratingPermutationWithState

  attr_accessor :orig_str, :value
                                                                                                                   
  def initialize(str)
    @orig_str = str
    @cont = nil
    @value = nil
    @found = false
  end
                                                                                                                   
  def recursive_each(chars_left,chars_built)
    if chars_left.empty?
      @value = chars_built.pack("c*")
      @found = true
      callcc {|@cont|} <============== error happens on this line
    else
      (0..(chars_left.length-1)).each { |index|
        return if @found
        new_char = chars_left[index]
        new_chars_left = chars_left.clone
        new_chars_left.delete_at(index)
        new_chars_built = chars_built.clone
        new_chars_built << new_char
        recursive_each(new_chars_left,new_chars_built)
      }
    end
  end
                                                                                                                   
  def start
    arr = @orig_str.unpack('c*')
    recursive_each(arr,Array.new())
  end

  def get_value
    if (@value == nil) then
      start
      if @found then
        return @value
      else
        return nil
      end
    else
      @found = false
      @cont.call
    end
  end

end

b = GeneratingPermutationWithState.new("abcdefghij")
while (b.get_value != nil)
end

perm.rb:17: [BUG] rb_gc_mark(): unknown data type 0x34(0x8a69570) non object
ruby 1.8.1 (2004-04-24) [i686-linux-gnu]

In rb_callcc(), th->thread is assigned too late (and not set to zero in
THREAD_ALLOC())

If ruby call the GC when it's in scope_dup() it will give the error
`unknown data type' when it try to mark th->thread

Guy Decoux

Hi,

···

In message "Re: [BUG] rb_gc_mark(): unknown data type 0x34(0x8a69570) non object" on 04/07/17, ts <decoux@moulon.inra.fr> writes:

perm.rb:17: [BUG] rb_gc_mark(): unknown data type 0x34(0x8a69570) non object
ruby 1.8.1 (2004-04-24) [i686-linux-gnu]

In rb_callcc(), th->thread is assigned too late (and not set to zero in
THREAD_ALLOC())

If ruby call the GC when it's in scope_dup() it will give the error
`unknown data type' when it try to mark th->thread

Thank you.

              matz.