From 234e762265f0b538e65d610751b8488cb596824d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 7 Jul 2016 15:38:01 +0200 Subject: Use on-disk compilation unit if available If we succeeded in saving the compilation unit to disk, then attempt to use it right away. This replaces the C++ heap usage for the compilation unit data as well as the anonymous allocated executable memory with file-backed mmap'ed memory. That means the memory can be discarded when overall availability is low and paged in on-demand. Change-Id: Ide1b1e11752d861eb049a99a26ca12cec5e2502e Reviewed-by: Ulf Hermann --- src/qml/compiler/qv4compileddata.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/compiler/qv4compileddata.cpp') diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index cb5c14ebc2..98eb7188cc 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -424,6 +424,7 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory return false; } + const Unit * const oldDataPtr = (data && !(data->flags & QV4::CompiledData::Unit::StaticData)) ? data : nullptr; QScopedValueRollback dataPtrChange(data, reinterpret_cast(cacheData)); { @@ -448,6 +449,7 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory return false; dataPtrChange.commit(); + free(const_cast(oldDataPtr)); backingFile.reset(cacheFile.take()); return true; } -- cgit v1.2.3