[Interest] QRegularExpressionMatch memory consumption
michael at videlgauz.com
Sat Oct 12 11:28:01 CEST 2013
here is part of my code:
int Parser::SomeFunction(const QString &line, int start, int& fieldStart,
int& fieldLength ) const
if (0 == m_pRegExp)
end = 19;
QRegularExpressionMatch match = m_pRegExp->match(line, start);
// currently we are requiring match to be found exactly at the
if (match.capturedStart() != start)
end = match.capturedEnd();
The program loads a text file and parses its lines one by one. The whole
purpose of code in ‘else’ scope is to calculate where a field ends (integer
‘end’) in the next line passed to the function.
When I compile with KNOWN_PATTERN #defined and load some test file, for
which I know ‘end’ should become 19, my program consumes about 400 MB less
memory than when compiled without KNOWN_PATTERN #defined.
400 MB is what all lines of my test file occupy in the memory (I can can
calculate it based of file size and also I watched memory consumption when
file was loaded and before parsing started).
So it seems to me that QRegularExpressionMatch creates a copies of each
line and does not release it. What am I missing here? Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest