You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Bill Scherer <ws...@vanteon.com> on 2000/07/17 18:09:21 UTC
Memory leaks in DOM Parse?
Hello, all.
I am seeing what appears to be a memory leak in the DOM Parsing routine.
I've boiled my code down as much as possible in order to simplify the
problem and I get the following.
Has anyone else seen a problem like this? If not, I'll track it down and
report back when I eventually find a solution. (I've seen the thread from
7/4/00 about the leak of fMap in the Sax Parser, but that was not the
problem in my case.)
I'm using the 1.2.0 distribution with a custom port to the Macintosh
platform. (When I get a chance, I'll compare notes with the Mac port that
was just submitted.)
Thanks!
-- Bill
------------------------------------------------------------
I have some code that calls the following routine in a loop, with the same
XML string each time. I've seen the problem with three different (valid) XML
strings, so I don't think that the string itself is meaningful. There is an
inverse relationship between the length of the string and the number of
passes through this function that succeed.
void StringParseTest(char *xmlString)
{
static const char *kMemBufId = "memBuffer";
// Create the XML object
_XMLObject *result = NULL;
MemBufInputSource * memBufIS = NULL;
try
{
DOMParser parser;
parser.setDoValidation(false);
// Create MemBufferInputSource from the src buffer
memBufIS = new MemBufInputSource(
(const XMLByte *)xmlString,
strlen(xmlString), kMemBufId, false);
// Parse
parser.parse(*memBufIS);
// If we got here, the parse succeeded
}
catch (...)
{
// We get here on parse failure
}
// Clean up the memBufInputSource
delete memBufIS;
// Done
return (XMLObject)result;
}
Bill Scherer
Advanced Development Engineer
Vanteon
2851 Clover St.
Pittsford, NY 14534
Tel: (716) 248-0510 x240
Fax: (716) 248-0537
mailto:wscherer@vanteon.com
www.vanteon.com