#20 Proposal for XML_ParserReset function

Feature Request

This is my first cut at adding a XML_ParserReset
function. My idea was to reset the parser to a state
that was almost identical to what it is after
XML_ParserCreate() except that any allocated memory is
preserved. As this patch is currently, I think it
misght still has some potential problems with dtdInit
() and possibly internalEncoding and setContext().
But for my documents/application it seems to work
great. It passes Purify without any memory leaks and
when parsing 5000 documents, I only get ~40 memory
allocations instead of ~200,000 :)

The function declartion needed for expat.h:

/* Resets an existing parser to a state comparable to
that after
XML_ParserCreate but preserves any allocated
memory. */

XML_ParserReset(XML_Parser parser, const XML_Char


  • David Crowley

    David Crowley - 2001-08-13

    Patch to add XML_ParserReset() to xmlparse.c

  • Fred L. Drake, Jr.

    • milestone: --> Feature Request
    • assigned_to: nobody --> fdrake
  • Fred L. Drake, Jr.

    Logged In: YES

    Well, the number of allocations being so substantially reduced is nice to know. I don't know just when I'll get a chance to look at this, but I promise I will get to it!

  • Fred L. Drake, Jr.

    • status: open --> closed-accepted
  • Fred L. Drake, Jr.

    Logged In: YES

    Checked in updated version of patch received by email as
    lib/xmlparse.c revision 1.30, with a prototype added to
    lib/expat.h revision 1.17.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks