diff options
author | Simon Hausmann <[email protected]> | 2014-04-09 15:09:16 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-04-09 16:49:09 +0200 |
commit | cdf718d0a58b31f0595281fc71ca4a3a6a81e41a (patch) | |
tree | eb1752e72c16002ae01e1d7b3fbb6e49434fde32 /src/qml/jsruntime | |
parent | 7b3eb5373a0d3611c5a83379c5eb59505cc5c074 (diff) |
Reduce memory pressure on JS stack when garbage collecting
As the identifier table grows with long running programs, we may end up
allocating more identifiers than we have space left on the JS stack for them
alongside all the other objects in the environment. To mitigate this, we can
simply treat the identifiers as roots, mark them manually and only end up
putting sub-strings onto the JS stack if necessary.
Task-number: QTBUG-36183
Change-Id: Ie6994555305c84b007860792d066a8df60089847
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4identifiertable_p.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4identifiertable_p.h b/src/qml/jsruntime/qv4identifiertable_p.h index 02fc8b70c6..09956fc342 100644 --- a/src/qml/jsruntime/qv4identifiertable_p.h +++ b/src/qml/jsruntime/qv4identifiertable_p.h @@ -80,9 +80,14 @@ public: Identifier *identifierImpl(const String *str); void mark(ExecutionEngine *e) { - for (int i = 0; i < alloc; ++i) - if (entries[i]) - entries[i]->mark(e); + for (int i = 0; i < alloc; ++i) { + String *entry = entries[i]; + if (!entry || entry->markBit) + continue; + entry->markBit = 1; + Q_ASSERT(entry->internalClass->vtable->markObjects); + entry->internalClass->vtable->markObjects(entry, e); + } } }; |