summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-02-26 09:05:39 (GMT)
committeraxis <qt-info@nokia.com>2010-02-26 09:05:39 (GMT)
commit5e9382c018e231c5e2ef49dd8a38eaff535b9837 (patch)
tree89f13d31d5804c38999fdefd0e2aca39d305f91c /src/script/api/qscriptengine_p.h
parent11e54877f87ff97039452f117d40ec17eefbcbff (diff)
parent53e7dda038e9251ca7380d3717709764c580192e (diff)
downloadQt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.zip
Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.gz
Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into master-s60
Conflicts: qmake/generators/symbian/initprojectdeploy_symbian.cpp qmake/generators/symbian/symmake_abld.h
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r--src/script/api/qscriptengine_p.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 79294fe..d0d020a 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -354,6 +354,8 @@ public:
int agentLineNumber;
QScriptValuePrivate *registeredScriptValues;
QScriptValuePrivate *freeScriptValues;
+ static const int maxFreeScriptValues = 256;
+ int freeScriptValuesCount;
QScriptStringPrivate *registeredScriptStrings;
QHash<int, QScriptTypeInfo*> m_typeInfos;
int processEventsInterval;
@@ -521,6 +523,7 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz
if (freeScriptValues) {
QScriptValuePrivate *p = freeScriptValues;
freeScriptValues = p->next;
+ --freeScriptValuesCount;
return p;
}
return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size));
@@ -528,8 +531,13 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz
inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p)
{
- p->next = freeScriptValues;
- freeScriptValues = p;
+ if (freeScriptValuesCount < maxFreeScriptValues) {
+ p->next = freeScriptValues;
+ freeScriptValues = p;
+ ++freeScriptValuesCount;
+ } else {
+ qFree(p);
+ }
}
inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value)