Hi, if I run the code it writes "Unhandled exception". I tried to add another try..except block and it's OK. program xml_leak_test; {$mode objfpc} uses heaptrc, Classes, DOM, XMLRead; var XMLDocument: TXMLDocument; InvalidStream: TStringStream; const INVALID_XML_CONTENT = '<<<INVALID XML>>>'; begin SetHeapTraceOutput('heap.trc'); XMLDocument := nil; InvalidStream := TStringStream.Create(INVALID_XML_CONTENT); try try ReadXMLFile(XMLDocument, InvalidStream); except end; finally InvalidStream.Free; XMLDocument.Free; end; end. Note: when I tried your original code in Lazaur method, it didn't leak at all. V. ______________________________________________________________ > Od: African Wild Dog <paintedlyc...@gmail.com> > Komu: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org> > Datum: 07.11.2017 23:19 > Předmět: [fpc-pascal] Memory Leak's in XMLRead unit > Hello,Using ReadXMLFile function from XMLRead unit generates memory leaks when trying to read a invalid XML content.....
---------- _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal