[Lazarus] Memory leaks when I read an XML file

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Jan 10 19:12:22 CET 2010


Pierre Delore wrote:
> ...
> I try to search in the wiki and I didn't found thing that help me.
> 
Since you did not specify your compiler version, I guess it's something pre-2.4.0.
See this link:
http://wiki.freepascal.org/User_Changes_2.4.0#dom_unit:_memory_management_for_node_lists

Either upgrade to 2.4.0, or add a matching call of Free for each call of ChildNodes.
The best solution, however, is to change the code to use FirstChild/NextSibling properties
instead of ChildNodes, because FirstChild/NextSibling are faster and don't create any intermediate 
objects.

Regards,
Sergei




More information about the Lazarus mailing list