aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/memory/qv4mm.cpp')
-rw-r--r--src/qml/memory/qv4mm.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 27adfcb517..88912a6678 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -161,6 +161,13 @@ struct MemorySegment {
size_t pageSize = WTF::pageSize();
size = (size + pageSize - 1) & ~(pageSize - 1);
+#if !defined(Q_OS_LINUX) && !defined(Q_OS_WIN)
+ // Linux and Windows zero out pages that have been decommitted and get committed again.
+ // unfortunately that's not true on other OSes (e.g. BSD based ones), so zero out the
+ // memory before decommit, so that we can be sure that all chunks we allocate will be
+ // zero initialized.
+ memset(chunk, 0, size);
+#endif
pageReservation.decommit(chunk, size);
}