diff options
author | axis <qt-info@nokia.com> | 2010-02-26 10:05:39 +0100 |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-02-26 10:05:39 +0100 |
commit | 5e9382c018e231c5e2ef49dd8a38eaff535b9837 (patch) | |
tree | 89f13d31d5804c38999fdefd0e2aca39d305f91c /src/script/api | |
parent | 11e54877f87ff97039452f117d40ec17eefbcbff (diff) | |
parent | 53e7dda038e9251ca7380d3717709764c580192e (diff) | |
download | qt4-tools-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.gz |
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')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 2 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 98a24d0567..d2e96d1e1e 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -844,7 +844,7 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng) } // namespace QScript QScriptEnginePrivate::QScriptEnginePrivate() - : registeredScriptValues(0), freeScriptValues(0), + : registeredScriptValues(0), freeScriptValues(0), freeScriptValuesCount(0), registeredScriptStrings(0), inEval(false) { qMetaTypeId<QScriptValue>(); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 79294fea2a..d0d020abd7 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) |