You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Hao Ling <ha...@nile.zpo.dec.com> on 2000/02/16 04:28:14 UTC

problem with DOMPrint example

Hi, 

When I use the release version of Xerces-C++ (Xerces-C_1_0_1-win32 or 
the new xerces-c_1_1_0_d05-win32), the DOMPrint sample will abort with an
error message: 
****************************************
Debug Assertion Failed!

program: ........\bin\DOMPrint.exe
File: dbgdel.cpp
Line: 47

Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
****************************************

This run-time error is disappear when I comment out the "delete"
instruction in the function "ostream& operator<<(ostream& target, const
DOMString&s)". That is the function is like

ostream& operator<<(ostream& target, const DOMString& s)
{
    char *p = s.transcode();
    target << p;
//    delete [] p;
    return target;
}

However, when I use the source files to build the Xerces and all of its
samples (using Xerces-C-src_1_0_1 and xerces-csrc_1_1_0_d05), the DOMPrint
sample runs very well without any change. 

Can anyone tell me why this is happen, and how to run the sample without 
commenting out the "delete" instruction. (I wonder there will be memory
leak when I omit the "delete" instruction.)

Thanks,
Hao Ling