Skip to content

Commit

Permalink
Add back the optional heaptrack trace points
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
amantia committed Feb 6, 2018
1 parent e227e3a commit 43b6e03
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/qml/memory/qv4mm.cpp
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}

Expand All @@ -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() {
Expand Down

0 comments on commit 43b6e03

Please sign in to comment.