--- El mié 8-oct-08, Sergei Gorelkin <[EMAIL PROTECTED]> escribió:
> De:: Sergei Gorelkin <[EMAIL PROTECTED]>
> Asunto: Re: [Lazarus] XML and memory loss
> A: "General mailing list" <[email protected]>
> Fecha: miércoles, 8 octubre, 2008, 10:49 am
> Bart wrote:
>
> ...
> >
> > This file is more or less as I excpected it to be (i
> would think it
> > would include the encoding="utf-8").
>
> Currently changing the encoding is not supported, and files
> are always
> written in utf-8 encoding. According to the XML specs,
> files without
> encoding label are read as utf-8, so this is by design.
> >
> > The problem is, that for every child I create and
> append, I loose 4
> > blocks of memory (60 bytes for these 4 blocks) (I used
> the heaptrace
> > option with compilation).
>
> The memory leak is caused by using the ChildNodes property.
> Each time
> you use it, a new TDOMNodeList object is created, which
> must be
> eventually destroyed by calling Free. The FCL DOM
> implementation does
> not offer automatic memory management here, unlike other
> implementations.
>
> Some time ago I updated the English page of Wiki tutorial
> to reflect
> this fact.
>
> In your case, ChildNodes.Item[0] can be replaced by
> FirstChild, which
> will return exactly the same node.
>
> Regards,
> Sergei
>
By the way, and taking the fact that xml files are stored always in utf-8
encoding it's surprising that for example XMLConfig doesn't have a way to set a
value which is already utf-8 encoded. so, any change to add a methods that take
utf-8 encoded strings as arguments?, this way it could ve avoided unnecesary
conversions.
Jesus Reyes A.
¡Todo sobre Amor y Sexo!
La guía completa para tu vida en Mujer de Hoy.
http://mx.mujer.yahoo.com/
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus