aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4mm.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-12-12 15:29:22 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-19 16:30:08 +0100
commit45ff1411d068c69d35a76b41e0d7da9a9d394d27 (patch)
tree0279861bef750063a16e4bd86f59007e8894328d /src/qml/jsruntime/qv4mm.cpp
parent0eac5a4938affdb930201df8be91cb9b6e1c93ac (diff)
Fix valgrind support in the memory manager
Fix compilation and ensure the memory manager doesn't create bogus warnings. Change-Id: I78ccfc7a11944f3275b7c03f6005874a561fa977 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4mm.cpp')
-rw-r--r--src/qml/jsruntime/qv4mm.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 4aebda0916..e2d1d19654 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -214,6 +214,7 @@ void sweepChunk(const MemoryManager::Data::Chunk &chunk, ChunkSweepData *sweepDa
sweepData->tail = m->nextFreeRef();
}
}
+ *sweepData->tail = 0;
#ifdef V4_USE_VALGRIND
VALGRIND_ENABLE_ERROR_REPORTING;
#endif
@@ -454,14 +455,22 @@ void MemoryManager::sweep(bool lastSweep)
chunkIter = m_d->heapChunks.erase(chunkIter);
continue;
} else if (chunkSweepData[i].head) {
+#ifdef V4_USE_VALGRIND
+ VALGRIND_DISABLE_ERROR_REPORTING;
+#endif
*tails[pos] = chunkSweepData[i].head;
+#ifdef V4_USE_VALGRIND
+ VALGRIND_ENABLE_ERROR_REPORTING;
+#endif
tails[pos] = chunkSweepData[i].tail;
}
++chunkIter;
}
- for (int pos = 0; pos < MemoryManager::Data::MaxItemSize/16; ++pos)
- *tails[pos] = 0;
+
#ifdef V4_USE_VALGRIND
+ VALGRIND_DISABLE_ERROR_REPORTING;
+ for (int pos = 0; pos < MemoryManager::Data::MaxItemSize/16; ++pos)
+ Q_ASSERT(*tails[pos] == 0);
VALGRIND_ENABLE_ERROR_REPORTING;
#endif