forked from qt-creator/qt-creator
save a memory reallocation for short-lived parse results
everything which is not stored in the parser cache is assumed to be disposed of rather soon anyway. this increases peak memory usage per evaluator by a few kilobytes (something in the order of five times the file size). as only manual spec parsing and eval() statemenents in projects use non-cached parsers, the impact is pretty much insignificant. Change-Id: I326f312f4dd98b30b692d219de7ae092b6ad3584 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -169,6 +169,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache)
|
|||||||
delete pro;
|
delete pro;
|
||||||
pro = 0;
|
pro = 0;
|
||||||
} else {
|
} else {
|
||||||
|
pro->itemsRef()->squeeze();
|
||||||
pro->ref();
|
pro->ref();
|
||||||
}
|
}
|
||||||
ent->pro = pro;
|
ent->pro = pro;
|
||||||
@@ -807,8 +808,8 @@ bool QMakeParser::read(ProFile *pro, const QString &in)
|
|||||||
}
|
}
|
||||||
while (m_blockstack.size())
|
while (m_blockstack.size())
|
||||||
leaveScope(tokPtr);
|
leaveScope(tokPtr);
|
||||||
xprBuff.clear();
|
tokBuff.resize(tokPtr - (ushort *)tokBuff.constData()); // Reserved capacity stays
|
||||||
*pro->itemsRef() = QString(tokBuff.constData(), tokPtr - (ushort *)tokBuff.constData());
|
*pro->itemsRef() = tokBuff;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#undef FLUSH_VALUE_LIST
|
#undef FLUSH_VALUE_LIST
|
||||||
|
|||||||
Reference in New Issue
Block a user