Hello, Using ReadXMLFile function from XMLRead unit generates memory leaks when trying to read a invalid XML content.
==== CODE ==== program xml_leak_test; 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 ReadXMLFile(XMLDocument, InvalidStream); finally InvalidStream.Free; XMLDocument.Free; end; end. ======= HEAP trace content: ==== HEAP === Heap dump by heaptrc unit 105 memory blocks allocated : 18943/19216 101 memory blocks freed : 18639/18912 4 unfreed memory blocks : 304 True heap size : 491520 (192 used in System startup) True free heap : 490400 Should be : 490512 Call trace for block $00000000011EA650 size 40 $000000010000B7AB $0000000100010A62 $0000000100010B6C $000000007720812D $00000000771F855F $000000007722BCB8 $000007FEFD0BA06D $BAADF00DBAADF00D Call trace for block $0000000001200B80 size 128 $00000001000141E6 $000000010000B78B $00000001000107D7 $0000000100010896 $0000000100037D56 $0000000100037C6E $0000000100037A82 $BAADF00DBAADF00D Call trace for block $0000000001208B70 size 88 $0000000100014347 $000000010000B78B $0000000100005E15 $000000010000513A $000000010002B9E8 $000000010002C000 $000000010002E4AF $BAADF00DBAADF00D Call trace for block $00000000011EA350 size 48 $000000010000B6F2 $00000001000090A7 $00000001000360A1 $0000000100037C42 $0000000100037A82 $000000010003786B $00000001000389F8 $BAADF00DBAADF00D ==========
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal