aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-06-28 11:25:18 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-04 13:29:10 +0000
commita253824a258c437bf1c8c67aefd6f5f928c9dfd7 (patch)
treeff393165de35bdddb65134ee199bdd936e9f6c5c /src/qml/jsruntime/qv4lookup.cpp
parent0577c9f35628ac2f63e6ce4e6fa73bb4614e29ae (diff)
Improve releasing of memory allocated from compilation unit strings
Allocate the strings in the compilation unit as regular strings, not as identifiers. We mark the runtimeStrings in the compilation unit, so when the unit is released as part of component cache trimming, those strings can also be collected. The JS object literal class keys have to remain identifiers though. However this is just a stop-gap as the real problem is that the identifier table can be triggered to grow without bounds. Task-number: QTBUG-61536 Change-Id: I7a2854b7fa9c9953348b5e34a31833f7be67cfbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index faaa5539ab..7a158ece35 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -40,6 +40,7 @@
#include "qv4functionobject_p.h"
#include "qv4scopedvalue_p.h"
#include "qv4string_p.h"
+#include <private/qv4identifiertable_p.h>
QT_BEGIN_NAMESPACE
@@ -49,7 +50,7 @@ using namespace QV4;
ReturnedValue Lookup::lookup(const Value &thisObject, Object *o, PropertyAttributes *attrs)
{
ExecutionEngine *engine = o->engine();
- Identifier *name = engine->current->compilationUnit->runtimeStrings[nameIndex]->identifier;
+ Identifier *name = engine->identifierTable->identifier(engine->current->compilationUnit->runtimeStrings[nameIndex]);
int i = 0;
Heap::Object *obj = o->d();
while (i < Size && obj) {
@@ -85,7 +86,7 @@ ReturnedValue Lookup::lookup(const Object *thisObject, PropertyAttributes *attrs
{
Heap::Object *obj = thisObject->d();
ExecutionEngine *engine = thisObject->engine();
- Identifier *name = engine->current->compilationUnit->runtimeStrings[nameIndex]->identifier;
+ Identifier *name = engine->identifierTable->identifier(engine->current->compilationUnit->runtimeStrings[nameIndex]);
int i = 0;
while (i < Size && obj) {
classList[i] = obj->internalClass;