Hello All,

I have problem using xerces 2.5.0 compiled with Visual Studio .Net on
Windows 2000 Pro.
I have this small source :

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
 XMLPlatformUtils::Initialize();
 int nRetCode = 0;
 CString mem = "<?xml version=\"1.0\" standalone=\"no\" ?><Operation
type=\"CheckID\"></Operation>";
#ifdef _DEBUG
   CMemoryState oldMemState, newMemState, diffMemState;
   oldMemState.Checkpoint();
#endif
 MemBufInputSource memBufIS((const XMLByte*)mem.GetBuffer(),
mem.GetLength(), "test", false);
 XercesDOMParser *domParser  = new XercesDOMParser;
 domParser->parse(memBufIS);
 delete domParser;
 domParser = NULL;
#ifdef _DEBUG
   newMemState.Checkpoint();
   if( diffMemState.Difference( oldMemState, newMemState ) )
   {
      TRACE( "Memory leaked!\n" );
   diffMemState.DumpStatistics();
   }
#endif
 XMLPlatformUtils::Terminate();
 return nRetCode;
}

Using CMemoryState  in this code, i see that after deleting of parser i
still have memory leaks:

>> Memory leaked!
>> 0 bytes in 0 Free Blocks.
>> 660 bytes in 31 Normal Blocks.
>> 0 bytes in 0 CRT Blocks.
>> 0 bytes in 0 Ignore Blocks.
>> 0 bytes in 0 Client Blocks.
>> Largest number used: 208270 bytes.
>> Total allocations: 208270 bytes.

I try lot of ways to do this parsing from buffer, but without any success, i
still have this leaks
and second, when i quit from program where desctructor of MemBufInputSource
is executed
program crash in destructor of InputSource on this place :

fMemoryManager->deallocate(fEncoding);

where fEncoding is NULL.I think will be better if before to try to release
memory some check
will be performed , like

if(fEncoding)
    fMemoryManager->deallocate(fEncoding);

about problem with memory leak i still didn't look where is the prob, so
if someone can help i will be happy :)

decho
 

Reply via email to