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

Memory leak

From: Nadav Armoni <NadavA@vineto.com>
Date: Thu, 30 Nov 2000 20:37:12 +0200
Message-ID: <70BB29F8AB8FDC4292D606B3F2EF222E02E4C8@rook.VINETO.vineto.com>
To: "'html-tidy@w3.org'" <html-tidy@w3.org>
Hi,

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?
Does my adding of this line can cause any harm to the program?

This is a sample page that has a <td> <font> </td> </font>, and that cause
the memory leak in function ParseRow
Thanks, Nadav. <<Page1.html>> 



Received on Thursday, 30 November 2000 13:38:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT