[Haskell-cafe] Re: Re: hxt memory useage
Rene de Visser
Rene_de_Visser at hotmail.com
Mon Jan 28 16:03:52 EST 2008
"Uwe Schmidt" <uwe at fh-wedel.de> schrieb im Newsbeitrag
news:200801281413.17375.uwe at fh-wedel.de...
> this statement isn't true in general. HXT itself can be incremental, if
> is no need for traversing the whole XML tree. When processing a document
> containing a DTD, indeed there is a need even when no validation is
> for traversal because of the entity substitution.
It would be nice if HXT was incremental even when you are processing the
If I remember correctly, the data type of the tree in HXT is something like
data Tree = Tree NodeData [Tree]
which means that already processed parts of the tree can't be garbage
collected because the parent node is holding onto them.
If instead it was
data Tree = Tree NodeData (IORef [Tree])
Would could remove each subtree as it was processed (well just before would
probably be necessary, and we would need to rely on blackholing to remove
the reference on the stack). This would perhaps allow already processed
subtree to be garbage collected. Together with the lazy evaluation this
could lead to quite good memory usage.
More information about the Haskell-Cafe