WinRT: Set alignment boundary to page size
authorMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Thu, 5 Mar 2015 07:31:50 +0000 (08:31 +0100)
committerMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Thu, 5 Mar 2015 15:52:58 +0000 (15:52 +0000)
This is a hard requirement from the QQmlEngine internals since 5.5 and
otherwise causes crashes inside the engine.

Change-Id: Id25f465576a0095f5b34da469abe761d3f3bd866
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp

index 9b8f5bf..ba251d2 100644 (file)
 
 namespace WTF {
 
+inline size_t getPageSize()
+{
+    SYSTEM_INFO info;
+    GetNativeSystemInfo(&info);
+    return info.dwPageSize;
+}
+
 void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool, bool)
 {
-    void* result = _aligned_malloc(bytes, 16);
+    static const size_t pageSize = getPageSize();
+    void* result = _aligned_malloc(bytes, pageSize);
     if (!result)
         CRASH();
     memset(result, 0, bytes);