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 <[email protected]>
> Komu: FPC-Pascal users discussions <[email protected]>
> 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 - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
<http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal