aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mm_p.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2024-01-17 16:19:54 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2024-03-05 14:06:30 +0100
commita32bcfe03db015f0b0e8c2e217dd603ad23edbba (patch)
tree6a7ab7b959845a275ccb79641672cdbdc5fe9205 /src/qml/memory/qv4mm_p.h
parent2b7e1b11a105af928a8d2999e60bb1110af3edae (diff)
qv4mm: Update non-managed memory limits at correct point in time
With the incremental gc, we might have not freed any memory at all after the gc call, as we might only be in the marking phase. Instead, update the limits when we know that we're done, after sweeping has completed. Additionally, move the assertion that the gc does not lose memory there, too, so that it also is called in all sweep calls. Change-Id: I444ff8817f39153f6f81bb6d21b6b87ae253a5f9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/memory/qv4mm_p.h')
-rw-r--r--src/qml/memory/qv4mm_p.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index ff74c4067c..3b623d22fa 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -325,6 +325,9 @@ public:
// and InternalClassDataPrivate<PropertyAttributes>.
void changeUnmanagedHeapSizeUsage(qptrdiff delta) { unmanagedHeapSize += delta; }
+ // called at the end of a gc cycle
+ void updateUnmanagedHeapSizeGCLimit();
+
template<typename ManagedType>
typename ManagedType::Data *allocIC()
{
@@ -380,16 +383,6 @@ private:
if (isAboveUnmanagedHeapLimit()) {
if (!didGCRun)
incrementalGCIsAlreadyRunning ? (void) tryForceGCCompletion() : runGC();
-
- if (3*unmanagedHeapSizeGCLimit <= 4 * unmanagedHeapSize) {
- // more than 75% full, raise limit
- unmanagedHeapSizeGCLimit = std::max(unmanagedHeapSizeGCLimit,
- unmanagedHeapSize) * 2;
- } else if (unmanagedHeapSize * 4 <= unmanagedHeapSizeGCLimit) {
- // less than 25% full, lower limit
- unmanagedHeapSizeGCLimit = qMax(std::size_t(MinUnmanagedHeapSizeGCLimit),
- unmanagedHeapSizeGCLimit/2);
- }
didGCRun = true;
}