uint allocCount[MaxItemSize/16];
int totalItems;
int totalAlloc;
+ uint maxShift;
struct Chunk {
PageAllocation memory;
int chunkSize;
, stackTop(0)
, totalItems(0)
, totalAlloc(0)
+ , maxShift(10)
, largeItems(0)
{
memset(smallItems, 0, sizeof(smallItems));
scribble = !qgetenv("QV4_MM_SCRIBBLE").isEmpty();
aggressiveGC = !qgetenv("QV4_MM_AGGRESSIVE_GC").isEmpty();
exactGC = qgetenv("QV4_MM_CONSERVATIVE_GC").isEmpty();
+
+ QByteArray overrideMaxShift = qgetenv("QV4_MM_MAXBLOCK_SHIFT");
+ bool ok;
+ uint override = overrideMaxShift.toUInt(&ok);
+ if (ok && override <= 11 && override > 0)
+ maxShift = override;
}
~Data()
// no free item available, allocate a new chunk
{
- // allocate larger chunks at a time to avoid excessive GC, but cap at 64M chunks
+ // allocate larger chunks at a time to avoid excessive GC, but cap at maximum chunk size (32MB by default)
uint shift = ++m_d->nChunks[pos];
- if (shift > 10)
- shift = 10;
+ if (shift > m_d->maxShift)
+ shift = m_d->maxShift;
std::size_t allocSize = CHUNK_SIZE*(size_t(1) << shift);
allocSize = roundUpToMultipleOf(WTF::pageSize(), allocSize);
Data::Chunk allocation;