From: Tony Arcieri Date: 2008-02-20T05:13:58+09:00 Subject: Stange error when using profile.rb on Ruby 1.9 ------=_Part_11854_28928297.1203452045429 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm encountering a rather strange error when attempting to use profile.rb on a Ruby 1.9 application: /opt/ruby1.9/lib/ruby/gems/1.9.0/gems/case-0.4/lib/case.rb:22:in `next': NULL pointer given (ArgumentError) from /opt/ruby1.9/lib/ruby/gems/1.9.0/gems/case-0.4/lib/case.rb:22:in `each' from /opt/ruby1.9/lib/ruby/gems/1.9.0/gems/case-0.4/lib/case.rb:22:in `zip' The error does not occur when the code is not being profiled. The code in question looks like this: module Array def ===(obj) return false unless ::Array === obj zip(obj) { |e,o| return false unless e === o } true end end The error itself is actually being raised in string.c: VALUE rb_str_new2(const char *ptr) { if (!ptr) { rb_raise(rb_eArgError, "NULL pointer given"); } return rb_str_new(ptr, strlen(ptr)); } I have no idea how using profile.rb is causing a NULL pointer to be passed to rb_str_new2 when zip is called... -- Tony Arcieri medioh.com ------=_Part_11854_28928297.1203452045429 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
I'm encountering a rather strange error when attempting to use profile.rb on a Ruby 1.9 application:

/opt/ruby1.9/lib/ruby/gems/1.9.0/gems/case-0.4/lib/case.rb:22:in `next': NULL pointer given (ArgumentError)
    from /opt/ruby1.9/lib/ruby/gems/1.9.0/gems/case-0.4/lib/case.rb:22:in `each'
    from /opt/ruby1.9/lib/ruby/gems/1.9.0/gems/case-0.4/lib/case.rb:22:in `zip'

The error does not occur when the code is not being profiled.  The code in question looks like this:

  module Array
    def ===(obj)
      return false unless ::Array === obj
      zip(obj) { |e,o| return false unless e === o }
      true
    end
  end

The error itself is actually being raised in string.c:

VALUE
rb_str_new2(const char *ptr)
{
    if (!ptr) {
        rb_raise(rb_eArgError, "NULL pointer given");
    }
    return rb_str_new(ptr, strlen(ptr));
}

I have no idea how using profile.rb is causing a NULL pointer to be passed to rb_str_new2 when zip is called...

--
Tony Arcieri
medioh.com ------=_Part_11854_28928297.1203452045429--