diff options
author | Andras Mantia <andras@kdab.com> | 2018-02-01 20:01:13 +0200 |
---|---|---|
committer | Andras Mantia <andras@kdab.com> | 2018-02-06 10:58:46 +0000 |
commit | 43b6e0323ac5252dd29b193a7965a0ef3252736e (patch) | |
tree | 166cae6cb4f78b69fab3f73c2301e7f8fc310219 | |
parent | e227e3a6ce9e18093fd74fabe0c4235b70f7b8f7 (diff) |
Add back the optional heaptrack trace points
This approach tracks object allocations only,
when slots from already allocated memory segment are used.
Change-Id: I514b974d7580c1236264bec96dc1abe594585e86
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/memory/qv4mm.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 4f4124d505..418c3444a4 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -321,6 +321,9 @@ bool Chunk::sweep(ExecutionEngine *engine) b->vtable()->destroy(b); b->_checkIsDestroyed(); } +#ifdef V4_USE_HEAPTRACK + heaptrack_report_free(itemToFree); +#endif } Q_V4_PROFILE_DEALLOC(engine, qPopulationCount((objectBitmap[i] | extendsBitmap[i]) - (blackBitmap[i] | e)) * Chunk::SlotSize, @@ -369,6 +372,9 @@ void Chunk::freeAll(ExecutionEngine *engine) b->vtable()->destroy(b); b->_checkIsDestroyed(); } +#ifdef V4_USE_HEAPTRACK + heaptrack_report_free(itemToFree); +#endif } Q_V4_PROFILE_DEALLOC(engine, (qPopulationCount(objectBitmap[i]|extendsBitmap[i]) - qPopulationCount(e)) * Chunk::SlotSize, Profiling::SmallItem); @@ -583,6 +589,9 @@ HeapItem *BlockAllocator::allocate(size_t size, bool forceAllocation) { done: m->setAllocatedSlots(slotsRequired); Q_V4_PROFILE_ALLOC(engine, slotsRequired * Chunk::SlotSize, Profiling::SmallItem); +#ifdef V4_USE_HEAPTRACK + heaptrack_report_alloc(m, slotsRequired * Chunk::SlotSize); +#endif // DEBUG << " " << hex << m->chunk() << m->chunk()->objectBitmap[0] << m->chunk()->extendsBitmap[0] << (m - m->chunk()->realBase()); return m; } @@ -628,6 +637,9 @@ HeapItem *HugeItemAllocator::allocate(size_t size) { chunks.push_back(HugeChunk{c, size}); Chunk::setBit(c->objectBitmap, c->first() - c->realBase()); Q_V4_PROFILE_ALLOC(engine, size, Profiling::LargeItem); +#ifdef V4_USE_HEAPTRACK + heaptrack_report_alloc(c, size); +#endif return c->first(); } @@ -640,6 +652,9 @@ static void freeHugeChunk(ChunkAllocator *chunkAllocator, const HugeItemAllocato b->_checkIsDestroyed(); } chunkAllocator->free(c.chunk, c.size); +#ifdef V4_USE_HEAPTRACK + heaptrack_report_free(c.chunk); +#endif } void HugeItemAllocator::sweep() { |