I created a testcase of ~50 lines which reproduces the problem.
The test case duplicates part of what is going on in my program. 

The problem is when the program exits, you get the following error.  On OS X, you get a different, but similar error.  Both errors complain about double free memory or deallocating memory inside a block.

*** glibc detected *** ruby: double free or corruption (fasttop): 0x09fef6e0 ***
======= Backtrace: =========
/lib/libc.so.6[0xbacf18]
/lib/libc.so.6(__libc_free+0x78)[0xbb03ef]
ruby(ruby_xfree+0x26)[0x806d936]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x11d)[0x713de5d]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x96)[0x713ddd6]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x96)[0x713ddd6]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x96)[0x713ddd6]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x96)[0x713ddd6]
/usr/lib/libxml2.so.2(xmlFreeDoc+0xcb)[0x713dbfb]
/usr/local/lib/ruby/site_ruby/1.8/i686-linux/xml/libxml_so.so(ruby_xml_document_free+0x95)[0xfa57e5]
ruby(rb_gc_call_finalizer_at_exit+0x87)[0x806db77]
ruby[0x80573e9]
ruby(ruby_cleanup+0xcc)[0x806327c]
ruby(ruby_stop+0x11)[0x8063351]
ruby[0x8068831]
ruby[0x80521d4]
/lib/libc.so.6(__libc_start_main+0xdc)[0xb5e724]
ruby[0x8052111]


You need two files (attached) to run the test case.  Just drop them anywhere and make sure they are in the same directory.

The test case simulates merging several xml files together, but in the test case, the merged files to be merged contain the same data, rather than different.

You have to tell the test case how many times to merge.  On my linux box, it is about 350.  On my OS X box, it is about 150.  Below those numbers, the error is not present. 

e.g.
ruby merge.rb 350

I really appreciate the help getting this resolved.  I played around with gdb and this error yesterday, but did not come up with anything helpful.    My C chops are, err.. poor.

Doug



On 5/31/06, Ross Bamford <[EMAIL PROTECTED]> wrote:
On Wed, 31 May 2006 21:50:01 +0100, Doug Bryant <[EMAIL PROTECTED]>
wrote:

> I'm getting the below error when the program I have written using
> libxml-ruby finishes running (when the program terminates).
>

Can you post your code?

--
Ross Bamford - [EMAIL PROTECTED]
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Attachment: merge.rb
Description: application/ruby

<?xml version="1.0"?>
<template>
  <body>
    <section>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>name: quack!</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>city: quack!</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>state: quack!</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <row>
        <txt>year: Vroom!</txt>
        <txt>make: Vroom!</txt>
        <txt>model: Vroom!</txt>
      </row>
      <row>
        <txt>year: Vroom!</txt>
        <txt>make: Vroom!</txt>
        <txt>model: Vroom!</txt>
      </row>
      <row>
        <txt>year: Vroom!</txt>
        <txt>make: Vroom!</txt>
        <txt>model: Vroom!</txt>
      </row>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
      <row>
        <txt>year: Vroom!</txt>
        <txt>make: Vroom!</txt>
        <txt>model: Vroom!</txt>
      </row>
      <row>
        <txt>year: Vroom!</txt>
        <txt>make: Vroom!</txt>
        <txt>model: Vroom!</txt>
      </row>
      <row>
        <txt>year: Vroom!</txt>
        <txt>make: Vroom!</txt>
        <txt>model: Vroom!</txt>
      </row>
      <txt>Some Preset Data Here</txt>
      <txt>Some Preset Data Here</txt>
    </section>
  </body>
</template>

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to