#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------+------------------------------------------------ Comment(by watson1978@…): I think, maybe this issue is GC of MacRuby or memory allocation of nokogiri. {{{ #!ruby require 'rubygems' gem 'nokogiri' require 'nokogiri' html_doc = Nokogiri::HTML("<html><body><h1>Mr. Belvedere Fan Club</h1></body></html>") p html_doc xml_doc = Nokogiri::XML("<root><aliens><alien><name>Alf</name></alien></aliens></root>") p xml_doc }}} diff of nokogiri: {{{ #!diff diff nokogiri.c.org nokogiri.c 34,36c34,36 < (xmlFreeFunc)ruby_xfree, < (xmlMallocFunc)ruby_xmalloc, < (xmlReallocFunc)ruby_xrealloc, ---
(xmlFreeFunc)free, (xmlMallocFunc)malloc, (xmlReallocFunc)realloc,
}}} Before apply patch: {{{ $ macruby nokogiri.rb zsh: segmentation fault macruby nokogiri.rb }}} After: {{{ $ macruby nokogiri.rb #<Nokogiri::HTML::Document:0x20032b4c0 name="document" children=[#<Nokogiri::XML::DTD:0x200323300 name="html">, #<Nokogiri::XML::Element:0x2002eaa60 name="html" children=[#<Nokogiri::XML::Element:0x2002c9900 name="body" children=[#<Nokogiri::XML::Element:0x2002d8380 name="h1" children=[#<Nokogiri::XML::Text:0x2002a74e0 "Mr. Belvedere Fan Club">]>]>]>]> #<Nokogiri::XML::Document:0x2003608c0 name="document" children=[#<Nokogiri::XML::Element:0x200323b80 name="root" children=[#<Nokogiri::XML::Element:0x200364040 name="aliens" children=[#<Nokogiri::XML::Element:0x2003346e0 name="alien" children=[#<Nokogiri::XML::Element:0x20030de20 name="name" children=[#<Nokogiri::XML::Text:0x2002fa820 "Alf">]>]>]>]>]> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/895#comment:2> MacRuby <http://macruby.org/>