From: Lars Knoll Date: Fri, 12 Dec 2014 14:29:22 +0000 (+0100) Subject: Fix valgrind support in the memory manager X-Git-Tag: v5.5.90+alpha1~652 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45ff1411d068c69d35a76b41e0d7da9a9d394d27;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp index 4aebda0..e2d1d19 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