Nick,

      The reported memory leak about the --qname-- had been solved in
the previous version, the actual "delete qname" is located at the
end of the function buildDFA().

      The leak related to --fHeadNode-- has been verified and *your fix*
has been applied and tested against BoundsChecker, no more memory
leak regarding fHeadNode, good job, thanks.

      The revised version of DFAContentModel is available from apache.

Regards,

Peiyong Zhang
____________________________________________
XML Parsers Development
IBM Toronto Laboratory email: [EMAIL PROTECTED]
Phone: (416)448-4088; Fax: (416)448-4414; T/L: 778-4088



Nick Chiang <[EMAIL PROTECTED]> on 08/16/2001 03:54:33 PM

Please respond to [EMAIL PROTECTED]

To:   "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:   Ron Ho <[EMAIL PROTECTED]>, Michael Tsu <[EMAIL PROTECTED]>
Subject:  memory leaks in Xerces-C++ 1.5.0 version


Hi,


I found two places may have memory leak problem.


        First, in src/validators/common/DFAContentModel.cpp Line 464
function DFAContentModel::buildDFA().


        statement:
        QName* qname = new QName(XMLUni::fgZeroLenString,
XMLUni::fgZeroLenString, XMLContentModel::gEOCFakeId);


        This needs to be freed after the next statement (CMLeaf* nodeEOC =
new CMLeaf(qname);).


        Original Source Code:


        QName* qname = new QName(XMLUni::fgZeroLenString,
XMLUni::fgZeroLenString, XMLContentModel::gEOCFakeId);
            CMLeaf* nodeEOC = new CMLeaf(qname);


        To fix the memory leak:


        QName* qname = new QName(XMLUni::fgZeroLenString,
XMLUni::fgZeroLenString, XMLContentModel::gEOCFakeId);
            CMLeaf* nodeEOC = new CMLeaf(qname);
        delete qname;


        Second, in src/validators/common/DFAContentModel.cpp Line 837.
fHeadNode has to be deleted, since delete 'fLeafList' only remove the
leaves in the tree. The other node such as CMAny, CMBinaryOp and CMUnaryOp
won't be freed. In order to correct this problem there are some codes need
to be change.


        Line: 836 Orig Code DFAContentModel.cpp


        //delete fHeadNode;
            fHeadNode = 0;


        New Code


        delete fHeadNode;
            //fHeadNode = 0;


        Line: 1046 Orig Code DFAContentModel.cpp


        fLeafList[newIndex] = (CMLeaf*)nodeCur;


        New Code


        fLeafList[newIndex] = new CMLeaf(((CMLeaf*)nodeCur)->getElement(),
                                           ((CMLeaf*)nodeCur)->getPosition
());





Regards,


Nick Chiang


PS: If you plan to fix the problem in future release, would you mind to let
me know the release number. Thanks.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to