Problem with libxml and Reader#expand not freeing memory

Hi,

I've already posted it to libxml-ruby tracker page, but I guess this
list is read by more people :slight_smile:

I'm trying to use libxml-ruby to parse ~250MB XML files. The files
contain list of similar elements, so I'm iterating
over each element and expand it with reader.expand:

reader.read # go to the first node
begin
  node = reader.expand
  import_data_to_db(node)
  GC.start
end while reader.next != 0

The problem is that the memory allocated by objects created using
reader.expand is not freed till the reader is closed, which is
actually equivalent to parsing the whole file in memory, which
contradicts the whole idea of using pull parser.

Anyone had similar issue?