Problem with libxml and Reader#expand not freeing memory

Discussion in 'Ruby' started by szimek, Jun 22, 2009.

  1. szimek

    szimek Guest

    Hi,

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

    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?
     
    szimek, Jun 22, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian Gregory
    Replies:
    1
    Views:
    533
  2. Olav
    Replies:
    3
    Views:
    4,372
  3. Benjamin Rutt
    Replies:
    0
    Views:
    330
    Benjamin Rutt
    Mar 30, 2006
  4. Rodrigo Dominguez

    memory allocation and freeing memory

    Rodrigo Dominguez, Jun 13, 2005, in forum: C Programming
    Replies:
    11
    Views:
    634
    Jean-Claude Arbaut
    Jun 15, 2005
  5. Jerry Krinock
    Replies:
    1
    Views:
    227
    Jerry Krinock
    Jul 26, 2008
Loading...

Share This Page