diff options
Diffstat (limited to 'src/qml/memory/qv4mm.cpp')
-rw-r--r-- | src/qml/memory/qv4mm.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 258fac57af..065204b5d3 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -61,6 +61,7 @@ #include <algorithm> #include "qv4alloca_p.h" #include "qv4profiling_p.h" +#include "qv4mapobject_p.h" //#define MM_STATS @@ -976,6 +977,18 @@ void MemoryManager::sweep(bool lastSweep, ClassDestroyStatsCallback classCountPt (*it) = Primitive::undefinedValue(); } + // remove objects from weak maps and sets + Heap::MapObject *map = weakMaps; + Heap::MapObject **lastMap = &weakMaps; + while (map) { + if (map->isMarked()) { + map->removeUnmarkedKeys(); + *lastMap = map; + lastMap = &map->nextWeakMap; + } + map = map->nextWeakMap; + } + // onDestruction handlers may have accessed other QObject wrappers and reset their value, so ensure // that they are all set to undefined. for (PersistentValueStorage::Iterator it = m_weakValues->begin(); it != m_weakValues->end(); ++it) { @@ -1179,6 +1192,12 @@ size_t MemoryManager::getLargeItemsMem() const return hugeItemAllocator.usedMem(); } +void MemoryManager::registerWeakMap(Heap::MapObject *map) +{ + map->nextWeakMap = weakMaps; + weakMaps = map; +} + MemoryManager::~MemoryManager() { delete m_persistentValues; |