aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-10-15 08:36:17 +0200
committerLars Knoll <lars.knoll@qt.io>2018-11-02 09:10:59 +0000
commit19b87999580d596a3b14e38f44309f16307bfe0e (patch)
tree8f1c40ca296a6414246002519af64aa124ce240c /src/qml/memory
parentacd0882f818bf05677e3e117dbd4975674d9578b (diff)
Fix a crash when allocating huge memory segments
When allocating a huge item that requires it's own memory segment, we were actually not committing enough memory from the OS. Fixes: QTBUG-71501 Change-Id: Ic86a648bba4d7f1eeeded78d8de0f0fc1d3a251d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/memory')
-rw-r--r--src/qml/memory/qv4mm.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index fb6d9478db..97254b9172 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -666,11 +666,10 @@ HeapItem *HugeItemAllocator::allocate(size_t size) {
Chunk *c = nullptr;
if (size >= MemorySegment::SegmentSize/2) {
// too large to handle through the ChunkAllocator, let's get our own memory segement
- size_t segmentSize = size + Chunk::HeaderSize; // space required for the Chunk header
+ size += Chunk::HeaderSize; // space required for the Chunk header
size_t pageSize = WTF::pageSize();
- segmentSize = (segmentSize + pageSize - 1) & ~(pageSize - 1); // align to page sizes
- m = new MemorySegment(segmentSize);
size = (size + pageSize - 1) & ~(pageSize - 1); // align to page sizes
+ m = new MemorySegment(size);
c = m->allocate(size);
} else {
c = chunkAllocator->allocate(size);