Re: [xml] [htmlParser] The right way to free a htmlParserCtxtPtr



On Tue, Nov 02, 2004 at 02:46:26PM +0100, Emmanuel Saracco wrote:
Le mardi 02 novembre 2004 à 03:52 -0500, Daniel Veillard a écrit :

Hi daniel,

[...]

-----
htmlParserCtxtPtr ctxt = NULL;

ctxt = htmlCreateMemoryParserCtxt (buffer, strlen (buffer));
htmlParseDocument (ctxt);

htmlFreeParserCtxt (ctxt);
-----

  that's fine.

Strange. I have a huge occupation of the memory using this. But it seems
to be ok when I use manually "xmlFreeDoc ()" on "ctxt->myDoc" after
calling "htmlFreeParserCtxt ()".

  Well usually when one parses a document it's to use it ! I was expecting
you actually collected the result and handled it, it's kind of a pointless
exercise otherwise (unless you just want to collect parser output).

   Use a normal API like htmlReadMemory() instead of attacking the
low level parser interfaces directly ... And yes, free the resulting
document after use.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]