What could cause an increasing memory usage or seeming memory leak error when running an XML based script?
A likely cause would be if handles opened in your script were not closed after use. Having such handles left open will gradually increase the memory utilization and this may result in the machine becoming slower to respond. It is recommended that you use XmlFreeHandle in your script to free any open handles as shown below:
transaction TMain var hDocument, hResult, hOrderItems, hItem, itemIx : number; sAttrValue : string; begin hDocument := XmlCreateDocumentFromFile("C:\\MyXMLDocuments\\Order.xml"); hOrderItems := XmlSelectNodes(hDocument, "//OrderItem"); hCount := XmlGetCount(hOrderItems); for itemIx := 0 to hCount - 1 do hItem := XmlGetItem(hOrderItems, itemIx); XmlGetAttributeByName(hItem, "price", sAttrValue); end; XmlFreeHandle(); end TMain;