[Qt-interest] XQuery memory leak?

Oliver Häger possex at web.de
Thu Feb 19 17:20:26 CET 2009


Hi,

I'm using the XmlPattern module to do some transformations, mainly XML-> XHTML.
The result will be shown in QWebView. On Win32 (vc90) I discovered that each XQuery transformation
reserves a considerable amount (100k+) of mem without releasing it. This can't be normal.

The related code is more or less like this:

void Transformator::execute(const QString & xqfn , QIODevice * out)
{
	QFile xqfile(xqfn);
	if(!xqfile.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		//...
	}
	
	QXmlQuery xquery;
	xquery.bindVariable( "__DOCUMENT__", QVariant("./model.xml") );
	xquery.setQuery(xqfile.readAll());
	QXmlSerializer s(xquery, out);
	xquery.evaluateTo(&s);	
}


void ::foo()
{
	QByteArray a;
	QBuffer buf(&a);
	buf.open(QIODevice::WriteOnly);
	Transformator t;
	t.execute("transform.xq",&buf); // in fact, there are different .xq files that are used

	mWebView->setContent(&buf);
}



More information about the Qt-interest-old mailing list