Markup declaration leak?

Hi,

  I have an application like

  #include "ParserEventGeneratorKit.h"

  class SgmlParserOpenSP2 : public SGMLApplication { } ;

  int main(int argc, char **argv)
  {
    char * url = "example.html";

    ParserEventGeneratorKit parserKit;
    parserKit.setOption(ParserEventGeneratorKit::addCatalog, "xml.soc");

    for (int i = 0; i < 500; ++i)
    {
        EventGenerator *egp = parserKit.makeEventGenerator(1, &url);
        egp->inhibitMessages(true) ; 
        SgmlParserOpenSP2 app;
        egp->run(app);
        delete egp;
    }

    return 0;
  }

example.html is a simple XHTML 1.0 Strict document. If OpenSP is unable
to find the DTD everything is more or less fine, but if it is able to
locate it, the program ends up consuming about 50 MB of memory on my
system. It's the same if parserKit is created inside the loop. Incresing
the number of markup declarations in the DTD also increases how much
memory is consumed. I am quite surprised, as I would expect that at
least Nick would have noticed such a memory leak.

I would appreciate if anyone could run code similar to that above and
tell whether it is possible to reproduce this elsewhere; especially on
Win32. If it is not possible to reproduce this on Linux but on Win32 it
might be a problem specific to the Win32 code... unless of course there
is something obviously wrong with my code.

TIA.

Received on Sunday, 22 August 2004 08:03:34 UTC