W3C home > Mailing lists > Public > www-archive@w3.org > August 2004

Markup declaration leak?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sun, 22 Aug 2004 10:02:43 +0200
To: openjade-devel@lists.sourceforge.net
Message-ID: <41295080.510667470@smtp.bjoern.hoehrmann.de>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:42:44 UTC