W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2000

Re: Memory leak

From: Dave Raggett <dsr@w3.org>
Date: Mon, 4 Dec 2000 02:04:01 +0000 (GMT Standard Time)
To: Nadav Armoni <NadavA@vineto.com>
cc: "'html-tidy@w3.org'" <html-tidy@w3.org>
Message-ID: <Pine.WNT.4.10.10012040202090.-529207@hazel.phone.com>
On Thu, 30 Nov 2000, Nadav Armoni wrote:

> I'm using Tidy to parse an HTML file and to build my own tree
> from the Tidy tree. When I run tidy in a loop on the same file (
> this file is attaced to this Email ) all night without writing
> back to the file ( this mean it was the same HTML file every
> time ) I noticed a memory leak. When I looked into the code of
> the Tidy, I found out that althogu Tidy report he is discarding
> an unexpected tag ( in this case </font>) he didn't free the
> node of that tag.
> So in function ParseRow ( in file: parser.c line:1752) I added
> this line:
> FreeNode( node );
> In order to free this node, and it worked for that perticular page.
> When I tested other pages, I found out the same probalm but in
> diffrent places in the code, So I checked a bit further and
> found out that tidy can discarde an unexpected tags in 68
> locations (all of them in file: parser.c), but in 15 places Tidy
> is not freeing the node after that.
> So my qustion is, should I add:
> 	FreeNode( node );
> to all of the 15 places, or maybe just to part of them?

It shouldn't do, provided it is followed by a "continue" to
get the next node. Thanks for spotting this. I will search
the code for the other such cases.


-- Dave Raggett <dsr@w3.org> or <dave.raggett@openwave.com>
W3C Visiting Fellow, see http://www.w3.org/People/Raggett 
tel/fax: +44 122 578 3011 (or 2521) +44 771 213 7629 (mobile)
Received on Sunday, 3 December 2000 21:04:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:49 UTC