aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorKarim Pinter <karim.pinter@digia.com>2014-03-25 17:34:52 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-01 09:43:17 +0200
commitd06dc2973821d3f5383c5a0d2ba16b6bddbadb82 (patch)
tree9f0b0603559d9ec94cb34621c12f5b76144a0a56 /src/qml/jsruntime
parent5915a3ec731ed61b88d869b41a4f98121e840219 (diff)
Making the CHUNKSIZE setable via environment variable
With this modification the CHUNKSIZE is setable by QV4_MM_MAX_CHUNK_SIZE environment variable so the memory usage which is important for embedded devices can be finetuned. Change-Id: I3cd75158f2255651edd341873de035c1222e3c92 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4mm.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 5a1e8b0821..70992a2323 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -76,9 +76,6 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
using namespace WTF;
-static const std::size_t CHUNK_SIZE = 1024*32;
-
-
struct MemoryManager::Data
{
bool gcBlocked;
@@ -94,6 +91,7 @@ struct MemoryManager::Data
int totalItems;
int totalAlloc;
uint maxShift;
+ std::size_t maxChunkSize;
struct Chunk {
PageAllocation memory;
int chunkSize;
@@ -126,6 +124,7 @@ struct MemoryManager::Data
, totalItems(0)
, totalAlloc(0)
, maxShift(6)
+ , maxChunkSize(32*1024)
, largeItems(0)
, deletable(0)
{
@@ -141,6 +140,11 @@ struct MemoryManager::Data
uint override = overrideMaxShift.toUInt(&ok);
if (ok && override <= 11 && override > 0)
maxShift = override;
+
+ QByteArray maxChunkString = qgetenv("QV4_MM_MAX_CHUNK_SIZE");
+ std::size_t tmpMaxChunkSize = maxChunkString.toUInt(&ok);
+ if (ok)
+ maxChunkSize = tmpMaxChunkSize;
}
~Data()
@@ -211,7 +215,7 @@ Managed *MemoryManager::alloc(std::size_t size)
uint shift = ++m_d->nChunks[pos];
if (shift > m_d->maxShift)
shift = m_d->maxShift;
- std::size_t allocSize = CHUNK_SIZE*(size_t(1) << shift);
+ std::size_t allocSize = m_d->maxChunkSize*(size_t(1) << shift);
allocSize = roundUpToMultipleOf(WTF::pageSize(), allocSize);
Data::Chunk allocation;
allocation.memory = PageAllocation::allocate(allocSize, OSAllocator::JSGCHeapPages);